Skip to content

Commit 6ffb164

Browse files
authored
refactor: enable linter rule QF1011 for 'Omit redundant types from declaration' (#89)
refactor: enable linter QF1011 'Omit redundant type from variable declaration'
1 parent 6f92582 commit 6ffb164

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ linters:
3939
- '-QF1003' # disable rule 'Convert if/else-if chain to tagged switch'
4040
- '-QF1004' # disable rule 'Use strings.ReplaceAll instead of strings.Replace'
4141
- '-QF1008' # disable rule 'Omit embedded fields from selector'
42-
- '-QF1011' # disable rule 'Omit redundant type from variable declaration'
4342
# https://golangci-lint.run/usage/linters/#staticcheck
4443
# https://staticcheck.dev/docs/configuration/options/#initialisms
4544
initialisms:

internal/auth/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (c *Client) auths(ctx context.Context) (map[string]types.SlackAuth, error)
203203
if err != nil {
204204
return auths, err
205205
}
206-
var path string = filepath.Join(dir, credentialsFileName)
206+
var path = filepath.Join(dir, credentialsFileName)
207207

208208
if _, err := c.fs.Stat(path); os.IsNotExist(err) {
209209
return auths, err

internal/config/system.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (c *SystemConfig) UserConfig(ctx context.Context) (*SystemConfig, error) {
117117
if err != nil {
118118
return &SystemConfig{}, err
119119
}
120-
var path string = filepath.Join(dir, configFileName)
120+
var path = filepath.Join(dir, configFileName)
121121

122122
if _, err := c.fs.Stat(path); os.IsNotExist(err) {
123123
return &config, err
@@ -424,7 +424,7 @@ func (c *SystemConfig) initializeConfigFiles(ctx context.Context, dir string) er
424424
defer span.Finish()
425425

426426
// ensure the credentials.json file exists
427-
var credentialsPath string = filepath.Join(dir, credentialsFileName)
427+
var credentialsPath = filepath.Join(dir, credentialsFileName)
428428
_, err := c.fs.Stat(credentialsPath)
429429
if os.IsNotExist(err) {
430430
// create the credentials file because it does not exist
@@ -435,7 +435,7 @@ func (c *SystemConfig) initializeConfigFiles(ctx context.Context, dir string) er
435435
}
436436

437437
// ensure the config.json file exists
438-
var configPath string = filepath.Join(dir, configFileName)
438+
var configPath = filepath.Join(dir, configFileName)
439439
_, err = c.fs.Stat(configPath)
440440
if os.IsNotExist(err) {
441441
err = c.writeConfigFile(configPath, []byte("{}\n"))
@@ -445,7 +445,7 @@ func (c *SystemConfig) initializeConfigFiles(ctx context.Context, dir string) er
445445
}
446446

447447
// ensure the logs folder exists
448-
var logsPath string = filepath.Join(dir, logsFolderName)
448+
var logsPath = filepath.Join(dir, logsFolderName)
449449
_, err = c.fs.Stat(logsPath)
450450
if os.IsNotExist(err) {
451451
// create the logs folder because it does not exist

internal/iostreams/logfile.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (io *IOStreams) InitLogFile(ctx context.Context) error {
5050
}()
5151

5252
// Ensure the error log file exists
53-
var errorLogFilePath string = filepath.Join(logFolder, filename)
53+
var errorLogFilePath = filepath.Join(logFolder, filename)
5454

5555
// TODO: this os reference should probably be something that is dependency injected for easier testing
5656
errorLogFile, err := os.OpenFile(errorLogFilePath, permissions, 0600)
@@ -99,7 +99,7 @@ func (io *IOStreams) FlushToLogFile(ctx context.Context, prefix, errStr string)
9999
}
100100

101101
// Ensure the error log file exists
102-
var errorLogFilePath string = filepath.Join(logFolder, filename)
102+
var errorLogFilePath = filepath.Join(logFolder, filename)
103103

104104
errorLogFile, err := io.fs.OpenFile(errorLogFilePath, permissions, 0600)
105105
if err != nil {
@@ -126,7 +126,7 @@ func (io *IOStreams) FinishLogFile(ctx context.Context) {
126126
logFolder, _ := io.config.SystemConfig.LogsDir(ctx)
127127

128128
// Ensure the error log file exists
129-
var errorLogFilePath string = filepath.Join(logFolder, filename)
129+
var errorLogFilePath = filepath.Join(logFolder, filename)
130130

131131
// TODO: this os reference should probably be something that is dependency injected for easier testing
132132
errorLogFile, err := os.OpenFile(errorLogFilePath, permissions, 0600)

internal/iostreams/survey.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ func (io *IOStreams) retrieveFlagValue(flagset []*pflag.Flag) (*pflag.Flag, erro
505505
func errInteractivityFlags(cfg PromptConfig) error {
506506
flags := cfg.GetFlags()
507507
var remediation string
508-
var helpMessage string = "Learn more about this command with `--help`"
508+
var helpMessage = "Learn more about this command with `--help`"
509509

510510
if len(flags) == 1 {
511511
remediation = fmt.Sprintf("Try running the command with the `--%s` flag included", flags[0].Name)

internal/pkg/auth/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func saveNewAuth(ctx context.Context, apiClient api.APIInterface, authClient aut
227227
}
228228

229229
// Write to credentials json if serviceTokenFlag is false
230-
var filePath string = ""
230+
var filePath = ""
231231
if !noRotation {
232232
_, credentialsLocation, err := authClient.SetAuth(ctx, newAuth)
233233
if err != nil {

0 commit comments

Comments
 (0)