Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errorlint linter issues (#65) #68

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ linters:
enable-all: true
disable:
# Enable these and fix the issues
- errorlint
- forbidigo
- forcetypeassert
- gci
Expand Down
4 changes: 3 additions & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package cmd

import (
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -73,7 +74,8 @@ func initializeConfig(cmd *cobra.Command) error {
// if we cannot parse the config file.
if err := v.ReadInConfig(); err != nil {
// It's okay if there isn't a config file
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
var cfgError viper.ConfigFileNotFoundError
if ok := errors.As(err, &cfgError); !ok {
return err
}
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func TestCmdFlags(t *testing.T) {
Name: "version verbose",
Args: slice("version", "--verbose"),
VersionConfig: &versionConfig{Verbose: true},
}, {
},
{
Name: "version no verbose",
Args: slice("version", "--verbose=false"),
VersionConfig: &versionConfig{Verbose: false},
Expand Down