diff --git a/src/cmd/bucket.go b/src/cmd/bucket.go index e3c17b51..5c6f944b 100644 --- a/src/cmd/bucket.go +++ b/src/cmd/bucket.go @@ -15,7 +15,7 @@ func bucketCmd() *cmdBuilder.Cmd { AddChildrenCmd(bucketS3Cmd()) } -// FIXME - janhajek better place? +// TODO - janhajek better place? const ( xAmzAclName = "x-amz-acl" ) diff --git a/src/cmd/bucketS3.go b/src/cmd/bucketS3.go index 74550c15..08a76aa1 100644 --- a/src/cmd/bucketS3.go +++ b/src/cmd/bucketS3.go @@ -16,7 +16,7 @@ func bucketS3Cmd() *cmdBuilder.Cmd { AddChildrenCmd(bucketS3DeleteCmd()) } -// FIXME - janhajek better place? +// TODO - janhajek better place? const ( s3ServerRegion = "us-east-1" accessKeyIdName = "accessKeyId" diff --git a/src/cmd/bucketS3Delete.go b/src/cmd/bucketS3Delete.go index da069cb7..fd472e54 100644 --- a/src/cmd/bucketS3Delete.go +++ b/src/cmd/bucketS3Delete.go @@ -42,7 +42,7 @@ func bucketS3DeleteCmd() *cmdBuilder.Cmd { } if !confirm { - // FIXME - janhajek message + // TODO - janhajek message fmt.Println("you have to confirm it") return nil } diff --git a/src/cmd/bucketZeropsDelete.go b/src/cmd/bucketZeropsDelete.go index c4912f75..560d92a8 100644 --- a/src/cmd/bucketZeropsDelete.go +++ b/src/cmd/bucketZeropsDelete.go @@ -27,7 +27,7 @@ func bucketZeropsDeleteCmd() *cmdBuilder.Cmd { } serviceId := cmdData.Service.ID - // FIXME - janhajek duplicate + // TODO - janhajek duplicate bucketName := fmt.Sprintf("%s.%s", strings.ToLower(serviceId.Native()), cmdData.Args["bucketName"][0]) confirm, err := YesNoPromptDestructive(ctx, cmdData, i18n.T(i18n.BucketDeleteConfirm, bucketName)) @@ -36,7 +36,7 @@ func bucketZeropsDeleteCmd() *cmdBuilder.Cmd { } if !confirm { - // FIXME - janhajek message + // TODO - janhajek message fmt.Println("you have to confirm it") return nil } diff --git a/src/cmd/login.go b/src/cmd/login.go index 22474f08..d3a7c9dc 100644 --- a/src/cmd/login.go +++ b/src/cmd/login.go @@ -93,7 +93,7 @@ func getLoginRegion( } } - // FIXME - janhajek translation + // TODO - janhajek translation header := (&uxBlock.TableRow{}).AddStringCells("Name") tableBody := &uxBlock.TableBody{} diff --git a/src/cmd/projectDelete.go b/src/cmd/projectDelete.go index b60f3812..8c06e59b 100644 --- a/src/cmd/projectDelete.go +++ b/src/cmd/projectDelete.go @@ -24,7 +24,7 @@ func projectDeleteCmd() *cmdBuilder.Cmd { } if !confirm { - // FIXME - janhajek message + // TODO - janhajek message fmt.Println("you have to confirm it") return nil } diff --git a/src/cmd/projectImport.go b/src/cmd/projectImport.go index 73a40ee6..03def1e3 100644 --- a/src/cmd/projectImport.go +++ b/src/cmd/projectImport.go @@ -23,10 +23,10 @@ func projectImportCmd() *cmdBuilder.Cmd { LoggedUserRunFunc(func(ctx context.Context, cmdData *cmdBuilder.LoggedUserCmdData) error { uxBlocks := cmdData.UxBlocks - // FIXME - janhajek client via flag - // FIXME - janhajek interactive selector of clients + // TODO - janhajek client via flag + // TODO - janhajek interactive selector of clients - // FIXME - janhajek config + // TODO - janhajek config yamlContent, err := yamlReader.ReadContent(uxBlocks, cmdData.Args[projectImportArgName][0], "./") if err != nil { return err @@ -35,7 +35,7 @@ func projectImportCmd() *cmdBuilder.Cmd { importProjectResponse, err := cmdData.RestApiClient.PostProjectImport( ctx, body.ProjectImport{ - // FIXME - janhajek client id + // TODO - janhajek client id ClientId: uuid.ClientId(cmdData.Args[projectImportArgName][0]), Yaml: types.Text(yamlContent), }, diff --git a/src/cmd/scopeProject.go b/src/cmd/scopeProject.go index ec645568..4b99d20e 100644 --- a/src/cmd/scopeProject.go +++ b/src/cmd/scopeProject.go @@ -28,7 +28,7 @@ func scopeProjectCmd() *cmdBuilder.Cmd { } cmdData.UxBlocks.PrintWarningLine(i18n.T(i18n.ScopedProjectNotFound)) } else { - // FIXME - janhajek message + // TODO - janhajek message cmdData.UxBlocks.PrintInfoLine("previously scoped project: " + project.Name.String()) } } diff --git a/src/cmd/scopeReset.go b/src/cmd/scopeReset.go index a8317bda..c92dc602 100644 --- a/src/cmd/scopeReset.go +++ b/src/cmd/scopeReset.go @@ -22,7 +22,7 @@ func scopeResetCmd() *cmdBuilder.Cmd { return err } - // FIXME - janhajek message + // TODO - janhajek message cmdData.UxBlocks.PrintInfoLine("scope reset") return nil diff --git a/src/cmd/serviceDelete.go b/src/cmd/serviceDelete.go index c59c466a..f1357892 100644 --- a/src/cmd/serviceDelete.go +++ b/src/cmd/serviceDelete.go @@ -23,7 +23,7 @@ func serviceDeleteCmd() *cmdBuilder.Cmd { } if !confirm { - // FIXME - janhajek message + // TODO - janhajek message fmt.Println("you have to confirm it") return nil } diff --git a/src/cmd/serviceDeploy.go b/src/cmd/serviceDeploy.go index 434720bb..f1b7a0c7 100644 --- a/src/cmd/serviceDeploy.go +++ b/src/cmd/serviceDeploy.go @@ -84,12 +84,12 @@ func serviceDeployCmd() *cmdBuilder.Cmd { return err } - // FIXME - janhajek merge with sdk client? + // TODO - janhajek merge with sdk client? httpClient := httpClient.New(ctx, httpClient.Config{ HttpTimeout: time.Minute * 15, }) - // FIXME - janhajek spinner? + // TODO - janhajek spinner? uxBlocks.PrintInfoLine(i18n.T(i18n.BuildDeployUploadingPackageStart)) if err := packageUpload(httpClient, appVersion.UploadUrl.String(), r); err != nil { // if an error occurred while packing the app, return that error diff --git a/src/cmd/serviceLog.go b/src/cmd/serviceLog.go index 49209037..a0b1f354 100644 --- a/src/cmd/serviceLog.go +++ b/src/cmd/serviceLog.go @@ -64,7 +64,7 @@ func serviceLogCmd() *cmdBuilder.Cmd { Format: cmdData.Params.GetString("format"), FormatTemplate: cmdData.Params.GetString("formatTemplate"), Follow: cmdData.Params.GetBool("follow"), - // FIXME - janhajek better place? + // TODO - janhajek better place? Levels: serviceLogs.Levels{ {"EMERGENCY", "0"}, {"ALERT", "1"}, diff --git a/src/cmd/servicePush.go b/src/cmd/servicePush.go index 34bfb4da..fef91438 100644 --- a/src/cmd/servicePush.go +++ b/src/cmd/servicePush.go @@ -23,7 +23,7 @@ import ( "github.com/zeropsio/zerops-go/types" ) -// FIXME - janhajek shared +// TODO - janhajek shared const ZeropsYamlFileName = "zerops.yaml" func servicePushCmd() *cmdBuilder.Cmd { @@ -78,12 +78,12 @@ func servicePushCmd() *cmdBuilder.Cmd { return err } - // FIXME - janhajek merge with sdk client + // TODO - janhajek merge with sdk client HttpClient := httpClient.New(ctx, httpClient.Config{ HttpTimeout: time.Minute * 15, }) - // FIXME - janhajek spinner? + // TODO - janhajek spinner? uxBlocks.PrintInfoLine(i18n.T(i18n.BuildDeployUploadingPackageStart)) if err := packageUpload(HttpClient, appVersion.UploadUrl.String(), r); err != nil { // if an error occurred while packing the app, return that error diff --git a/src/cmd/statusShowDebugLogs.go b/src/cmd/statusShowDebugLogs.go index e1ed0578..e083ff3b 100644 --- a/src/cmd/statusShowDebugLogs.go +++ b/src/cmd/statusShowDebugLogs.go @@ -32,7 +32,7 @@ func statusShowDebugLogsCmd() *cmdBuilder.Cmd { filesize := stat.Size() if filesize == 0 { - // FIXME - janhajek translate + // TODO - janhajek translate fmt.Println("No logs found") return nil } diff --git a/src/cmd/uxHelpers.go b/src/cmd/uxHelpers.go index 426870cd..4fb3429c 100644 --- a/src/cmd/uxHelpers.go +++ b/src/cmd/uxHelpers.go @@ -11,7 +11,7 @@ func YesNoPromptDestructive(ctx context.Context, cmdData *cmdBuilder.LoggedUserC return true, nil } - // FIXME - janhajek translate + // TODO - janhajek translate choices := []string{"no", "yes"} choice, err := cmdData.UxBlocks.Prompt(ctx, message, choices) if err != nil { @@ -26,7 +26,7 @@ func YesNoPromptNonDestructive(ctx context.Context, cmdData *cmdBuilder.LoggedUs return true, nil } - // FIXME - janhajek translate + // TODO - janhajek translate choices := []string{"no", "yes"} choice, err := cmdData.UxBlocks.Prompt(ctx, message, choices) if err != nil { diff --git a/src/cmdBuilder/cmdBuilderCreateRunFunc.go b/src/cmdBuilder/cmdBuilderCreateRunFunc.go index 5f59ec62..a161e3b3 100644 --- a/src/cmdBuilder/cmdBuilderCreateRunFunc.go +++ b/src/cmdBuilder/cmdBuilderCreateRunFunc.go @@ -145,16 +145,16 @@ func (b *CmdBuilder) createCmdRunFunc(cmd *Cmd, params *params.Handler) func(*co cmdData.RestApiClient = zeropsRestApiClient.NewAuthorizedClient(token, storedData.RegionData.RestApiAddress) for _, dep := range getDependencyListFromRoot(cmd.scopeLevel) { - err := dep.LoadSelectedScope(cobraCmd.Context(), cmd, cmdData) + err := dep.LoadSelectedScope(ctx, cmd, cmdData) if err != nil { return err } } - return cmd.loggedUserRunFunc(cobraCmd.Context(), cmdData) + return cmd.loggedUserRunFunc(ctx, cmdData) } - return cmd.guestRunFunc(cobraCmd.Context(), guestCmdData) + return cmd.guestRunFunc(ctx, guestCmdData) } } @@ -175,13 +175,13 @@ func convertArgs(cmd *Cmd, args []string) (map[string][]string, error) { } if len(args) < requiredArgsCount { - // FIXME - janhajek message + // TODO - janhajek message return nil, errors.Errorf("expected at least %d arg(s), got %d", requiredArgsCount, len(args)) } // the last arg is not an array, max number of given args can't be greater than the number of registered args if !isArray && len(args) > len(cmd.args) { - // FIXME - janhajek message + // TODO - janhajek message return nil, errors.Errorf("expected no more than %d arg(s), got %d", len(cmd.args), len(args)) } @@ -233,7 +233,7 @@ func getQuietMode(isTerminal bool) (QuietMode, error) { case QuietModeConfirmNothing, QuietModeConfirmAll, QuietModeConfirmOnlyDestructive: return QuietMode(QuietModeFlag), nil default: - // FIXME - janhajek message + // TODO - janhajek message return 0, errors.New("unknown quiet mode") } } @@ -247,7 +247,7 @@ func isTerminal() (bool, error) { case TerminalModeEnabled: return true, nil default: - // FIXME - janhajek message + // TODO - janhajek message return false, errors.New("unknown terminal mode") } } diff --git a/src/cmdBuilder/cmdBuilderCreateRunFunc_test.go b/src/cmdBuilder/cmdBuilderCreateRunFunc_test.go index 5f1adb13..41f60710 100644 --- a/src/cmdBuilder/cmdBuilderCreateRunFunc_test.go +++ b/src/cmdBuilder/cmdBuilderCreateRunFunc_test.go @@ -165,6 +165,7 @@ func TestConvertArgs(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { got, err := convertArgs(tt.args.cmd, tt.args.args) if tt.wantErr != "" { diff --git a/src/cmdBuilder/cmdBuilderExecuteRootCmd.go b/src/cmdBuilder/cmdBuilderExecuteRootCmd.go index a6a434af..1db123f2 100644 --- a/src/cmdBuilder/cmdBuilderExecuteRootCmd.go +++ b/src/cmdBuilder/cmdBuilderExecuteRootCmd.go @@ -23,8 +23,8 @@ type TerminalMode string const ( TerminalModeAuto TerminalMode = "auto" - TerminalModeDisabled = "disabled" - TerminalModeEnabled = "enabled" + TerminalModeDisabled TerminalMode = "disabled" + TerminalModeEnabled TerminalMode = "enabled" ) var TerminalFlag string @@ -71,7 +71,7 @@ func createRootCommand() *cobra.Command { SilenceErrors: true, } - // FIXME - janhajek add a dynamic help for subcommands + // TODO - janhajek add a dynamic help for subcommands rootCmd.Flags().BoolP("help", "h", false, i18n.T(i18n.DisplayHelp)+i18n.T(i18n.GroupHelp)) rootCmd.PersistentFlags().IntVar(&QuietModeFlag, "quiet", int(QuietModeConfirmAll), i18n.T(i18n.QuietModeFlag)) diff --git a/src/cmdBuilder/dependencyTree.go b/src/cmdBuilder/dependencyTree.go index d6b54c11..1612123a 100644 --- a/src/cmdBuilder/dependencyTree.go +++ b/src/cmdBuilder/dependencyTree.go @@ -5,7 +5,7 @@ import ( "slices" ) -// FIXME - janhajek do we need interface? +// TODO - janhajek do we need interface? type Dependency interface { AddCommandFlags(*Cmd) LoadSelectedScope(ctx context.Context, cmd *Cmd, cmdData *LoggedUserCmdData) error @@ -20,7 +20,7 @@ func (c *commonDependency) GetParent() Dependency { return c.parent } -// FIXME - janhajek move back cmd? +// TODO - janhajek move back cmd? var Project *project var Service *service diff --git a/src/cmdBuilder/dependencyTreeProject.go b/src/cmdBuilder/dependencyTreeProject.go index ffb6d730..defaecdf 100644 --- a/src/cmdBuilder/dependencyTreeProject.go +++ b/src/cmdBuilder/dependencyTreeProject.go @@ -18,7 +18,7 @@ type project struct { const ProjectArgName = "projectId" func (p *project) AddCommandFlags(cmd *Cmd) { - // FIXME - janhajek translation + // TODO - janhajek translation cmd.StringFlag(ProjectArgName, "", "Project id") } diff --git a/src/cmdBuilder/dependencyTreeService.go b/src/cmdBuilder/dependencyTreeService.go index e5f10697..1d5c82ba 100644 --- a/src/cmdBuilder/dependencyTreeService.go +++ b/src/cmdBuilder/dependencyTreeService.go @@ -18,7 +18,7 @@ const ServiceArgName = "serviceIdOrName" const ServiceFlagName = "serviceId" func (s *service) AddCommandFlags(cmd *Cmd) { - // FIXME - janhajek translation + // TODO - janhajek translation cmd.StringFlag(ServiceFlagName, "", "Service id") } diff --git a/src/constants/darwin.go b/src/constants/darwin.go index ecb32b7d..6c8032f5 100644 --- a/src/constants/darwin.go +++ b/src/constants/darwin.go @@ -26,6 +26,13 @@ func getDataFilePaths() []pathReceiver { func getLogFilePath() []pathReceiver { return []pathReceiver{ + func() (string, error) { + env := os.Getenv(cliLogFilePathEnvVar) + if env != "" { + return env, nil + } + return "", errors.New("env is empty") + }, func() (string, error) { return path.Join("/usr/local/var/log/", zeropsLogFile), nil }, diff --git a/src/constants/linux.go b/src/constants/linux.go index 596eb93b..989649e9 100644 --- a/src/constants/linux.go +++ b/src/constants/linux.go @@ -6,10 +6,19 @@ package constants import ( "os" "path" + + "github.com/pkg/errors" ) func getDataFilePaths() []pathReceiver { return []pathReceiver{ + func() (string, error) { + env := os.Getenv(cliDataFilePathEnvVar) + if env != "" { + return env, nil + } + return "", errors.New("env is empty") + }, receiverWithPath(os.UserConfigDir, zeropsDir, cliDataFileName), receiverWithPath(os.UserHomeDir, zeropsDir, cliDataFileName), } @@ -17,6 +26,13 @@ func getDataFilePaths() []pathReceiver { func getLogFilePath() []pathReceiver { return []pathReceiver{ + func() (string, error) { + env := os.Getenv(cliLogFilePathEnvVar) + if env != "" { + return env, nil + } + return "", errors.New("env is empty") + }, func() (string, error) { return path.Join("/var/log/", zeropsDir, zeropsLogFile), nil }, diff --git a/src/constants/windows.go b/src/constants/windows.go index 604f5299..ec8e705c 100644 --- a/src/constants/windows.go +++ b/src/constants/windows.go @@ -5,11 +5,22 @@ package constants import ( "os" - "path" + + "github.com/pkg/errors" ) +// this line is here to make linter happy +var _ = zeropsDir + func getDataFilePaths() []pathReceiver { return []pathReceiver{ + func() (string, error) { + env := os.Getenv(cliDataFilePathEnvVar) + if env != "" { + return env, nil + } + return "", errors.New("env is empty") + }, receiverWithPath(os.UserConfigDir, "Zerops", cliDataFileName), receiverWithPath(os.UserHomeDir, "Zerops", cliDataFileName), } @@ -18,7 +29,11 @@ func getDataFilePaths() []pathReceiver { func getLogFilePath() []pathReceiver { return []pathReceiver{ func() (string, error) { - return path.Join("/usr/local/var/log/", zeropsLogFile), nil + env := os.Getenv(cliLogFilePathEnvVar) + if env != "" { + return env, nil + } + return "", errors.New("env is empty") }, receiverWithPath(os.UserConfigDir, "Zerops", zeropsLogFile), receiverWithPath(os.UserHomeDir, "Zerops", zeropsLogFile), diff --git a/src/constants/zerops.go b/src/constants/zerops.go index 2820d8ab..990c11a9 100644 --- a/src/constants/zerops.go +++ b/src/constants/zerops.go @@ -51,7 +51,7 @@ func findFirstWritablePath(paths []pathReceiver) (string, error) { } } - // FIXME - janhajek translate + // TODO - janhajek translate return "", errors.Errorf("Unable to find writable path from %v", checkedPaths) } diff --git a/src/httpClient/handler.go b/src/httpClient/handler.go index bb946d64..51b9cc14 100644 --- a/src/httpClient/handler.go +++ b/src/httpClient/handler.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "io" - "io/ioutil" "net/http" "time" @@ -46,12 +45,6 @@ func ContentType(contentType string) Option { } } -func BearerAuthorization(token string) Option { - return func(cfg *optionConfig) { - cfg.headers["Authorization"] = "Bearer " + token - } -} - type optionConfig struct { headers map[string]string } @@ -103,7 +96,7 @@ func (h *Handler) doStream(method string, url string, body io.Reader, options .. } defer resp.Body.Close() - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) if err != nil { return Response{}, err } diff --git a/src/logger/handler.go b/src/logger/handler.go index 0eab13a3..8df325c1 100644 --- a/src/logger/handler.go +++ b/src/logger/handler.go @@ -10,14 +10,7 @@ import ( "github.com/sirupsen/logrus" ) -type Config struct { - FilePath string - IsTerminal bool -} - type Handler struct { - config Config - logrus *logrus.Logger } diff --git a/src/serviceLogs/handler_checkInputValues.go b/src/serviceLogs/handler_checkInputValues.go index f706a394..6e2cd282 100644 --- a/src/serviceLogs/handler_checkInputValues.go +++ b/src/serviceLogs/handler_checkInputValues.go @@ -77,7 +77,7 @@ func (h *Handler) getMinSeverity(config RunConfig) (intVal int, err error) { return key, nil } } - intVal, err = strconv.Atoi(ms) + _, err = strconv.Atoi(ms) if err != nil { return 1, fmt.Errorf("%s %s", i18n.T(i18n.LogMinSeverityInvalid), i18n.T(i18n.LogMinSeverityStringLimitErr)) } diff --git a/src/serviceLogs/handler_getLogs.go b/src/serviceLogs/handler_getLogs.go index 854b5b03..9eca8e97 100644 --- a/src/serviceLogs/handler_getLogs.go +++ b/src/serviceLogs/handler_getLogs.go @@ -3,7 +3,7 @@ package serviceLogs import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" "time" ) @@ -50,7 +50,7 @@ func getLogs(ctx context.Context, method, url, format, formatTemplate, mode stri defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return err diff --git a/src/serviceLogs/handler_run.go b/src/serviceLogs/handler_run.go index 49530125..d91fe828 100644 --- a/src/serviceLogs/handler_run.go +++ b/src/serviceLogs/handler_run.go @@ -10,7 +10,7 @@ func (h *Handler) Run(ctx context.Context, config RunConfig) error { return err } - // FIXME - janhajek check empty containerID + // TODO - janhajek check empty containerID if err = h.printLogs(ctx, inputs, config.Project.ID, config.ServiceId, config.Container.ID); err != nil { return err } diff --git a/src/serviceLogs/handler_ws.go b/src/serviceLogs/handler_ws.go index a8fa1353..473a40da 100644 --- a/src/serviceLogs/handler_ws.go +++ b/src/serviceLogs/handler_ws.go @@ -26,10 +26,11 @@ func (h *Handler) getLogStream( interrupt := make(chan os.Signal, 1) // Channel to listen for interrupt signal to terminate gracefully signal.Notify(interrupt, os.Interrupt) // Notify the interrupt channel for SIGINT - conn, _, err := websocket.DefaultDialer.Dial(url, nil) + conn, reps, err := websocket.DefaultDialer.Dial(url, nil) if err != nil { return fmt.Errorf("%s %s\n", i18n.T(i18n.LogReadingFailed), err.Error()) } + defer reps.Body.Close() defer conn.Close() done := make(chan interface{}) // Channel to indicate that the receiverHandler is done diff --git a/src/storage/handler.go b/src/storage/handler.go index a15466b8..7583c26a 100644 --- a/src/storage/handler.go +++ b/src/storage/handler.go @@ -13,9 +13,12 @@ type Config struct { } type Handler[T any] struct { + //nolint:structcheck // Why: `is unused` error is false positive config Config - data T - lock sync.RWMutex + //nolint:structcheck // Why: `is unused` error is false positive + data T + //nolint:structcheck // Why: `is unused` error is false positive + lock sync.RWMutex } func New[T any](config Config) (*Handler[T], error) { @@ -51,7 +54,7 @@ func (h *Handler[T]) load() error { } if err := json.NewDecoder(f).Decode(&h.data); err != nil { - // FIXME - janhajek translation + // TODO - janhajek translation return errors.WithMessagef(err, "Unable to decode json file %s", h.config.FilePath) } diff --git a/src/uxBlock/blocks.go b/src/uxBlock/blocks.go index fc4cca1c..9f9fb7a1 100644 --- a/src/uxBlock/blocks.go +++ b/src/uxBlock/blocks.go @@ -12,7 +12,7 @@ type UxBlocks struct { outputLogger logger.Logger debugFileLogger logger.Logger - // FIXME - janhajek comment + // TODO - janhajek comment ctxCancel context.CancelFunc } diff --git a/src/uxBlock/prompt.go b/src/uxBlock/prompt.go index 34c585eb..e88b05ad 100644 --- a/src/uxBlock/prompt.go +++ b/src/uxBlock/prompt.go @@ -9,8 +9,7 @@ import ( ) type promptConfig struct { - label string - header *TableRow + label string } type PromptOption = func(cfg *promptConfig) @@ -26,7 +25,7 @@ func (b *UxBlocks) Prompt( opt(&cfg) } - // FIXME - janhajek fix message + // TODO - janhajek fix message if !b.isTerminal { return 0, errors.New(cfg.label + ", you can choose only in terminal") } diff --git a/src/uxBlock/select.go b/src/uxBlock/select.go index 3f63c032..e4408696 100644 --- a/src/uxBlock/select.go +++ b/src/uxBlock/select.go @@ -43,7 +43,7 @@ func (b *UxBlocks) Select(ctx context.Context, tableBody *TableBody, auxOptions opt(&cfg) } - // FIXME - janhajek fix message + // TODO - janhajek fix message if !b.isTerminal { return nil, errors.New(cfg.label + ", you can choose only in terminal") } diff --git a/src/uxBlock/spinner.go b/src/uxBlock/spinner.go index a2a3372a..63cee2e2 100644 --- a/src/uxBlock/spinner.go +++ b/src/uxBlock/spinner.go @@ -16,7 +16,7 @@ func (b *UxBlocks) RunSpinners(ctx context.Context, spinners []*Spinner, auxOpti //if !b.isTerminal { // return func(success bool) { - // // FIXME - janhajek + // // TODO - janhajek // //if success { // // b.info(cfg.successMessage) // //} else { @@ -42,7 +42,7 @@ func (b *UxBlocks) RunSpinners(ctx context.Context, spinners []*Spinner, auxOpti return func() { p.Send(spinnerEndCmd{}) p.Wait() - // FIXME - janhajek + // TODO - janhajek //if success { // b.info(cfg.successMessage) //} else { diff --git a/src/uxHelpers/project.go b/src/uxHelpers/project.go index eddd8003..1b7e4a22 100644 --- a/src/uxHelpers/project.go +++ b/src/uxHelpers/project.go @@ -66,7 +66,7 @@ func PrintProjectList( } func createProjectTableRows(projects []entity.Project) (*uxBlock.TableRow, *uxBlock.TableBody) { - // FIXME - janhajek translation + // TODO - janhajek translation header := (&uxBlock.TableRow{}).AddStringCells("ID", "Name", "Description", "Client ID", "Status") tableBody := &uxBlock.TableBody{} diff --git a/src/uxHelpers/service.go b/src/uxHelpers/service.go index 56b8069d..764bc0c5 100644 --- a/src/uxHelpers/service.go +++ b/src/uxHelpers/service.go @@ -69,7 +69,7 @@ func PrintServiceList( } func createServiceTableRows(projects []entity.Service) (*uxBlock.TableRow, *uxBlock.TableBody) { - // FIXME - janhajek translation + // TODO - janhajek translation header := (&uxBlock.TableRow{}).AddStringCells("ID", "Name", "Status") tableBody := &uxBlock.TableBody{} diff --git a/src/uxHelpers/spinner.go b/src/uxHelpers/spinner.go index 3fb0d110..ef41297a 100644 --- a/src/uxHelpers/spinner.go +++ b/src/uxHelpers/spinner.go @@ -20,7 +20,7 @@ func ProcessCheckWithSpinner( restApiClient *zeropsRestApiClient.Handler, processList []Process, ) error { - var spinners []*uxBlock.Spinner + spinners := make([]*uxBlock.Spinner, 0, len(processList)) for _, process := range processList { spinners = append(spinners, uxBlock.NewSpinner(process.RunningMessage)) } diff --git a/tools/install.sh b/tools/install.sh index 70dead43..e2f46a73 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -46,4 +46,4 @@ chmod +x bin/protoc rm -rf tmp # https://github.com/golangci/golangci-lint#go Please, do not installDaemon golangci-lint by go get -curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$GOBIN" v1.45.2 +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$GOBIN" v1.55.2