(ctx context.Context, data wshrpc.CommandWriteAppGoFileData)
| 1086 | } |
| 1087 | |
| 1088 | func (ws *WshServer) WriteAppGoFileCommand(ctx context.Context, data wshrpc.CommandWriteAppGoFileData) (*wshrpc.CommandWriteAppGoFileRtnData, error) { |
| 1089 | if data.AppId == "" { |
| 1090 | return nil, fmt.Errorf("must provide an appId to WriteAppGoFileCommand") |
| 1091 | } |
| 1092 | contents, err := base64.StdEncoding.DecodeString(data.Data64) |
| 1093 | if err != nil { |
| 1094 | return nil, fmt.Errorf("failed to decode data64: %w", err) |
| 1095 | } |
| 1096 | |
| 1097 | formattedOutput := waveapputil.FormatGoCode(contents) |
| 1098 | |
| 1099 | err = waveappstore.WriteAppFile(data.AppId, "app.go", formattedOutput) |
| 1100 | if err != nil { |
| 1101 | return nil, err |
| 1102 | } |
| 1103 | |
| 1104 | encoded := base64.StdEncoding.EncodeToString(formattedOutput) |
| 1105 | return &wshrpc.CommandWriteAppGoFileRtnData{Data64: encoded}, nil |
| 1106 | } |
| 1107 | |
| 1108 | func (ws *WshServer) DeleteAppFileCommand(ctx context.Context, data wshrpc.CommandDeleteAppFileData) error { |
| 1109 | if data.AppId == "" { |
nothing calls this directly
no test coverage detected