Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit ce19f61

Browse files
authored
Merge pull request #71 from nginxinc/fix-library-dependency
Make linter happy again
2 parents 12e56b4 + 291bb8a commit ce19f61

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

.golangci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ linters-settings:
3434
linters:
3535
enable:
3636
- asciicheck
37-
- deadcode
3837
- errcheck
3938
- gocyclo
4039
- errorlint
@@ -52,13 +51,10 @@ linters:
5251
- predeclared
5352
- revive
5453
- staticcheck
55-
- structcheck
5654
- typecheck
5755
- unconvert
5856
- unparam
5957
- unused
60-
- varcheck
61-
- wastedassign
6258
disable-all: true
6359
issues:
6460
max-issues-per-linter: 0

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ifeq (${TARGET},local)
1414
endif
1515

1616
test:
17-
go test ./...
17+
go test ./... -race -shuffle=on
1818

1919
lint:
2020
docker run --pull always --rm -v $(shell pwd):/nginx-ns1-gslb -w /nginx-ns1-gslb -v $(shell go env GOCACHE):/cache/go -e GOCACHE=/cache/go -e GOLANGCI_LINT_CACHE=/cache/go -v $(shell go env GOPATH)/pkg:/go/pkg golangci/golangci-lint:latest golangci-lint --color always run

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/nginxinc/nginx-ns1-gslb
22

3-
go 1.18
3+
go 1.19
44

55
require (
66
github.com/nginxinc/nginx-plus-go-client v0.10.0

internal/agent/configurator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package agent
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"os"
66

77
"github.com/nginxinc/nginx-ns1-gslb/internal/input"
88
"github.com/nginxinc/nginx-ns1-gslb/internal/output"
@@ -27,7 +27,7 @@ type Config struct {
2727

2828
// ParseConfig reads the configuration file and return a Config object ready to configure agent and resources
2929
func ParseConfig(path *string) (*Config, error) {
30-
data, err := ioutil.ReadFile(*path)
30+
data, err := os.ReadFile(*path)
3131
if err != nil {
3232
return nil, fmt.Errorf("error reading file at %v: %w", path, err)
3333
}

internal/agent/configurator_test.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,16 @@ func TestValidateServicesCfg(t *testing.T) {
111111
}
112112

113113
for _, testCase := range testCases {
114-
err := validateServicesCfg(testCase.cfg)
115-
if err == nil && testCase.wantErr {
116-
t.Errorf("validateServicesCfg err returned <nil>, but err expected an error for case %v", testCase.msg)
117-
}
118-
if err != nil && !testCase.wantErr {
119-
t.Errorf("validateServicesCfg returned an err: %v for case %v", err, testCase.msg)
120-
}
114+
t.Run(testCase.msg, func(t *testing.T) {
115+
t.Parallel()
116+
err := validateServicesCfg(testCase.cfg)
117+
if err == nil && testCase.wantErr {
118+
t.Errorf("validateServicesCfg err returned <nil>, but err expected an error for case %v", testCase.msg)
119+
}
120+
if err != nil && !testCase.wantErr {
121+
t.Errorf("validateServicesCfg returned an err: %v for case %v", err, testCase.msg)
122+
}
123+
})
121124
}
122125
}
123126

@@ -149,12 +152,15 @@ func TestParseExampleConfigs(t *testing.T) {
149152
}
150153

151154
for _, testCase := range testCases {
152-
_, err := ParseConfig(&testCase.path)
153-
if err == nil && testCase.wantErr {
154-
t.Errorf("ParseConfig err returned <nil>, but err expected an error for case %v", testCase.msg)
155-
}
156-
if err != nil && !testCase.wantErr {
157-
t.Errorf("ParseConfig returned an err: %v for case %v", err, testCase.msg)
158-
}
155+
t.Run(testCase.msg, func(t *testing.T) {
156+
t.Parallel()
157+
_, err := ParseConfig(&testCase.path)
158+
if err == nil && testCase.wantErr {
159+
t.Errorf("ParseConfig err returned <nil>, but err expected an error for case %v", testCase.msg)
160+
}
161+
if err != nil && !testCase.wantErr {
162+
t.Errorf("ParseConfig returned an err: %v for case %v", err, testCase.msg)
163+
}
164+
})
159165
}
160166
}

0 commit comments

Comments
 (0)