Skip to content

Commit 3dca577

Browse files
committed
Updated linter and fixed warnings
1 parent c428dc3 commit 3dca577

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

.golangci.yml

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
run:
2+
skip-dirs:
3+
- legacy
4+
15
linters-settings:
26
govet:
37
check-shadowing: true
@@ -21,6 +25,9 @@ linters-settings:
2125
linters:
2226
enable-all: true
2327
disable:
28+
- goimports
29+
- gocritic
30+
- gochecknoglobals
2431
- gosec
2532
- deadcode
2633
- dupl

.travis.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ env:
1010
# build and immediately stop. It's sorta like having set -e enabled in bash.
1111
# Make sure golangci-lint is vendored.
1212
before_install:
13-
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.10.2
14-
# Download the binary to bin folder in $GOPATH
15-
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
13+
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.16.0
1614

1715
install: true
1816

common/formatter/formatter.go

+5-9
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,14 @@ type Formatter interface {
3737
// PrintFunc represents a function used to print formatted data.
3838
type PrintFunc func(Formatter, interface{}) error
3939

40-
var formatters map[string]Formatter
41-
var defaultFormatter Formatter
40+
var formatters = map[string]Formatter{
41+
"text": &TextFormatter{},
42+
"json": &JSONFormatter{},
43+
}
44+
var defaultFormatter = formatters["text"]
4245

4346
var logger *logrus.Logger
4447

45-
func init() {
46-
formatters = make(map[string]Formatter, 2)
47-
AddCustomFormatter("text", &TextFormatter{})
48-
AddCustomFormatter("json", &JSONFormatter{})
49-
defaultFormatter = formatters["text"]
50-
}
51-
5248
// SetFormatter sets the defaults format to the one specified, if valid. Otherwise it returns an error.
5349
func SetFormatter(formatName string) error {
5450
if !IsSupported(formatName) {

configs/navigate_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ func TestNavigate(t *testing.T) {
3636
"inheritance",
3737
}
3838
for _, tt := range tests {
39-
t.Run(tt, func(t *testing.T) {
40-
pwd := paths.New("testdata", "navigate", tt, "first", "second")
41-
golden := filepath.Join("testdata", "navigate", tt, "golden.yaml")
39+
_tt := tt
40+
t.Run(_tt, func(t *testing.T) {
41+
pwd := paths.New("testdata", "navigate", _tt, "first", "second")
42+
golden := filepath.Join("testdata", "navigate", _tt, "golden.yaml")
4243

4344
config, _ := configs.NewConfiguration()
4445

0 commit comments

Comments
 (0)