Skip to content

Commit

Permalink
Upgrade linter and fix linting problems
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
  • Loading branch information
pedro-stanaka committed Nov 17, 2023
1 parent 9921908 commit 9e2da93
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v3

- name: Setup go
uses: actions/setup-go@v3.3.0
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

Expand Down
5 changes: 1 addition & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ output:

linters:
enable:
- depguard
- dupl
- goconst
- gocritic
- gofmt
- goimports
- golint
- gosec
- govet
- lll
- maligned
- megacheck
- misspell
- nakedret
Expand All @@ -37,7 +34,7 @@ linters-settings:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
min-occurrences: 3 # now is inclusive
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
Expand Down
2 changes: 1 addition & 1 deletion bin/style
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Style
class << self
INSTALLER_URL = 'https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh'
EXECUTABLE = 'golangci-lint'
VERSION = '1.49.0'
VERSION = '1.55.2'
VERSION_TAG = "v#{VERSION}"

def call
Expand Down
4 changes: 3 additions & 1 deletion srvutil/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"github.com/Shopify/goose/statsd"
)

const httpScheme = "http://"

func TestRequestMetricsMiddleware(t *testing.T) {
var recordedTags []string
statsd.SetBackend(statsd.NewForwardingBackend(func(_ context.Context, mType string, name string, value interface{}, tags []string, _ float64) error {
Expand Down Expand Up @@ -58,7 +60,7 @@ func TestRequestMetricsMiddleware(t *testing.T) {
defer s.Tomb().Kill(nil)
safely.Run(s)

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

req, err := http.NewRequest("GET", u, nil)
req.Header.Set("Authorization", "secret")
Expand Down
8 changes: 4 additions & 4 deletions srvutil/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func ExampleNewServer() {
defer s.Tomb().Kill(nil)
safely.Run(s)

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

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

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

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

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

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

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

done := make(chan struct{})
Expand Down

0 comments on commit 9e2da93

Please sign in to comment.