Skip to content

Commit 9e2da93

Browse files
committed
Upgrade linter and fix linting problems
Signed-off-by: Pedro Tanaka <[email protected]>
1 parent 9921908 commit 9e2da93

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

.github/workflows/go.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ jobs:
6464

6565
steps:
6666
- name: Checkout
67-
uses: actions/checkout@v3.1.0
67+
uses: actions/checkout@v3
6868

6969
- name: Setup go
70-
uses: actions/setup-go@v3.3.0
70+
uses: actions/setup-go@v3
7171
with:
7272
go-version: ${{ matrix.go-version }}
7373

.golangci.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@ output:
1313

1414
linters:
1515
enable:
16-
- depguard
1716
- dupl
1817
- goconst
1918
- gocritic
2019
- gofmt
2120
- goimports
22-
- golint
2321
- gosec
2422
- govet
2523
- lll
26-
- maligned
2724
- megacheck
2825
- misspell
2926
- nakedret
@@ -37,7 +34,7 @@ linters-settings:
3734
threshold: 100
3835
goconst:
3936
min-len: 2
40-
min-occurrences: 2
37+
min-occurrences: 3 # now is inclusive
4138
goimports:
4239
# put imports beginning with prefix after 3rd-party packages;
4340
# it's a comma-separated list of prefixes

bin/style

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Style
88
class << self
99
INSTALLER_URL = 'https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh'
1010
EXECUTABLE = 'golangci-lint'
11-
VERSION = '1.49.0'
11+
VERSION = '1.55.2'
1212
VERSION_TAG = "v#{VERSION}"
1313

1414
def call

srvutil/metrics_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"github.com/Shopify/goose/statsd"
2323
)
2424

25+
const httpScheme = "http://"
26+
2527
func TestRequestMetricsMiddleware(t *testing.T) {
2628
var recordedTags []string
2729
statsd.SetBackend(statsd.NewForwardingBackend(func(_ context.Context, mType string, name string, value interface{}, tags []string, _ float64) error {
@@ -58,7 +60,7 @@ func TestRequestMetricsMiddleware(t *testing.T) {
5860
defer s.Tomb().Kill(nil)
5961
safely.Run(s)
6062

61-
u := "http://" + s.Addr().String() + "/hello/world"
63+
u := httpScheme + s.Addr().String() + "/hello/world"
6264

6365
req, err := http.NewRequest("GET", u, nil)
6466
req.Header.Set("Authorization", "secret")

srvutil/server_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func ExampleNewServer() {
3838
defer s.Tomb().Kill(nil)
3939
safely.Run(s)
4040

41-
u := "http://" + s.Addr().String() + "/hello/world"
41+
u := httpScheme + s.Addr().String() + "/hello/world"
4242

4343
res, _ := http.Get(u)
4444
io.Copy(os.Stdout, res.Body)
@@ -64,7 +64,7 @@ func TestNewServer(t *testing.T) {
6464
defer s.Tomb().Kill(nil)
6565
safely.Run(s)
6666

67-
u := "http://" + s.Addr().String()
67+
u := httpScheme + s.Addr().String()
6868
t.Logf("test server running on %s", u)
6969

7070
assert.Contains(t, logOutput.String(), "level=info msg=\"starting server\" bind=\"127.0.0.1:0\"")
@@ -127,7 +127,7 @@ func TestNewServerFromFactory(t *testing.T) {
127127
defer s.Tomb().Kill(nil)
128128
safely.Run(s)
129129

130-
u := "http://" + s.Addr().String()
130+
u := httpScheme + s.Addr().String()
131131
t.Logf("test server running on %s", u)
132132

133133
assert.Contains(t, logOutput.String(), "level=info msg=\"starting server\" bind=\"127.0.0.1:0\"")
@@ -205,7 +205,7 @@ func TestStoppableKeepaliveListener_Accept(t *testing.T) {
205205
s := NewServer(tb, "127.0.0.1:0", sl)
206206
safely.Run(s)
207207

208-
u := "http://" + s.Addr().String()
208+
u := httpScheme + s.Addr().String()
209209
t.Logf("test server running on %s", u)
210210

211211
done := make(chan struct{})

0 commit comments

Comments
 (0)