diff --git a/.golangci.yml b/.golangci.yml index 1d9acd9c..87b448d4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -39,7 +39,6 @@ linters: - '-QF1003' # disable rule 'Convert if/else-if chain to tagged switch' - '-QF1004' # disable rule 'Use strings.ReplaceAll instead of strings.Replace' - '-QF1008' # disable rule 'Omit embedded fields from selector' - - '-QF1011' # disable rule 'Omit redundant type from variable declaration' # https://golangci-lint.run/usage/linters/#staticcheck # https://staticcheck.dev/docs/configuration/options/#initialisms initialisms: diff --git a/internal/auth/auth.go b/internal/auth/auth.go index b2b3152b..5398214c 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -203,7 +203,7 @@ func (c *Client) auths(ctx context.Context) (map[string]types.SlackAuth, error) if err != nil { return auths, err } - var path string = filepath.Join(dir, credentialsFileName) + var path = filepath.Join(dir, credentialsFileName) if _, err := c.fs.Stat(path); os.IsNotExist(err) { return auths, err diff --git a/internal/config/system.go b/internal/config/system.go index e2cef0c4..7e879fdb 100644 --- a/internal/config/system.go +++ b/internal/config/system.go @@ -117,7 +117,7 @@ func (c *SystemConfig) UserConfig(ctx context.Context) (*SystemConfig, error) { if err != nil { return &SystemConfig{}, err } - var path string = filepath.Join(dir, configFileName) + var path = filepath.Join(dir, configFileName) if _, err := c.fs.Stat(path); os.IsNotExist(err) { return &config, err @@ -424,7 +424,7 @@ func (c *SystemConfig) initializeConfigFiles(ctx context.Context, dir string) er defer span.Finish() // ensure the credentials.json file exists - var credentialsPath string = filepath.Join(dir, credentialsFileName) + var credentialsPath = filepath.Join(dir, credentialsFileName) _, err := c.fs.Stat(credentialsPath) if os.IsNotExist(err) { // create the credentials file because it does not exist @@ -435,7 +435,7 @@ func (c *SystemConfig) initializeConfigFiles(ctx context.Context, dir string) er } // ensure the config.json file exists - var configPath string = filepath.Join(dir, configFileName) + var configPath = filepath.Join(dir, configFileName) _, err = c.fs.Stat(configPath) if os.IsNotExist(err) { err = c.writeConfigFile(configPath, []byte("{}\n")) @@ -445,7 +445,7 @@ func (c *SystemConfig) initializeConfigFiles(ctx context.Context, dir string) er } // ensure the logs folder exists - var logsPath string = filepath.Join(dir, logsFolderName) + var logsPath = filepath.Join(dir, logsFolderName) _, err = c.fs.Stat(logsPath) if os.IsNotExist(err) { // create the logs folder because it does not exist diff --git a/internal/iostreams/logfile.go b/internal/iostreams/logfile.go index 44c2c4da..fde4938c 100644 --- a/internal/iostreams/logfile.go +++ b/internal/iostreams/logfile.go @@ -50,7 +50,7 @@ func (io *IOStreams) InitLogFile(ctx context.Context) error { }() // Ensure the error log file exists - var errorLogFilePath string = filepath.Join(logFolder, filename) + var errorLogFilePath = filepath.Join(logFolder, filename) // TODO: this os reference should probably be something that is dependency injected for easier testing errorLogFile, err := os.OpenFile(errorLogFilePath, permissions, 0600) @@ -99,7 +99,7 @@ func (io *IOStreams) FlushToLogFile(ctx context.Context, prefix, errStr string) } // Ensure the error log file exists - var errorLogFilePath string = filepath.Join(logFolder, filename) + var errorLogFilePath = filepath.Join(logFolder, filename) errorLogFile, err := io.fs.OpenFile(errorLogFilePath, permissions, 0600) if err != nil { @@ -126,7 +126,7 @@ func (io *IOStreams) FinishLogFile(ctx context.Context) { logFolder, _ := io.config.SystemConfig.LogsDir(ctx) // Ensure the error log file exists - var errorLogFilePath string = filepath.Join(logFolder, filename) + var errorLogFilePath = filepath.Join(logFolder, filename) // TODO: this os reference should probably be something that is dependency injected for easier testing errorLogFile, err := os.OpenFile(errorLogFilePath, permissions, 0600) diff --git a/internal/iostreams/survey.go b/internal/iostreams/survey.go index 3dda6de9..22477afa 100644 --- a/internal/iostreams/survey.go +++ b/internal/iostreams/survey.go @@ -505,7 +505,7 @@ func (io *IOStreams) retrieveFlagValue(flagset []*pflag.Flag) (*pflag.Flag, erro func errInteractivityFlags(cfg PromptConfig) error { flags := cfg.GetFlags() var remediation string - var helpMessage string = "Learn more about this command with `--help`" + var helpMessage = "Learn more about this command with `--help`" if len(flags) == 1 { remediation = fmt.Sprintf("Try running the command with the `--%s` flag included", flags[0].Name) diff --git a/internal/pkg/auth/login.go b/internal/pkg/auth/login.go index 56a7db57..d2e1b285 100644 --- a/internal/pkg/auth/login.go +++ b/internal/pkg/auth/login.go @@ -227,7 +227,7 @@ func saveNewAuth(ctx context.Context, apiClient api.APIInterface, authClient aut } // Write to credentials json if serviceTokenFlag is false - var filePath string = "" + var filePath = "" if !noRotation { _, credentialsLocation, err := authClient.SetAuth(ctx, newAuth) if err != nil {