Skip to content

Commit ac47661

Browse files
committed
bump golangci-lint
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 23f270a commit ac47661

31 files changed

+135
-178
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
cache: true
3434
- uses: golangci/golangci-lint-action@v6
3535
with:
36-
version: v1.55.2
36+
version: v1.64.2
3737
args: --verbose
3838
skip-cache: true
3939
- name: Test

.golangci.yml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,37 @@ issues:
44
linters:
55
disable-all: true
66
enable:
7-
- errorlint
8-
- gocritic
9-
- gofmt
10-
- goimports
11-
- gomodguard
12-
- gosimple
13-
- govet
14-
- ineffassign
15-
- misspell
16-
- nakedret
17-
- revive
18-
- testifylint
7+
- copyloopvar
8+
- depguard
9+
- errcheck
10+
- errorlint
11+
- gocritic
12+
- gocyclo
13+
- gofmt
14+
- goimports
15+
- gomodguard
16+
- revive
17+
- gosimple
18+
- govet
19+
- ineffassign
20+
- lll
21+
- misspell
22+
- nakedret
23+
- nolintlint
24+
- revive
25+
- staticcheck
26+
- testifylint
27+
- typecheck
28+
- unconvert
29+
- unparam
30+
- unused
1931
linters-settings:
32+
depguard:
33+
rules:
34+
all:
35+
deny:
36+
- pkg: gopkg.in/yaml.v2
37+
desc: 'compose-go uses yaml.v3'
2038
gocritic:
2139
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
2240
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
@@ -35,6 +53,8 @@ linters-settings:
3553
recommendations:
3654
- errors
3755
- fmt
56+
lll:
57+
line-length: 200
3858
testifylint:
3959
disable:
4060
- float-compare

ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ FROM golang:1.21
1616

1717
WORKDIR /go/src
1818

19-
ARG GOLANGCILINT_VERSION=v1.55.2
19+
ARG GOLANGCILINT_VERSION=v1.64.5
2020
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCILINT_VERSION}
2121
RUN go install github.com/kunalkushwaha/ltag@latest && rm -rf /go/src/github.com/kunalkushwaha
2222

cli/options.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package cli
1818

1919
import (
2020
"context"
21-
"fmt"
2221
"io"
2322
"os"
2423
"path/filepath"
@@ -30,7 +29,6 @@ import (
3029

3130
"github.com/compose-spec/compose-go/v2/consts"
3231
"github.com/compose-spec/compose-go/v2/dotenv"
33-
"github.com/compose-spec/compose-go/v2/errdefs"
3432
"github.com/compose-spec/compose-go/v2/loader"
3533
"github.com/compose-spec/compose-go/v2/types"
3634
"github.com/compose-spec/compose-go/v2/utils"
@@ -551,14 +549,6 @@ func withListeners(options *ProjectOptions) func(*loader.Options) {
551549
}
552550
}
553551

554-
// getConfigPaths retrieves the config files for project based on project options
555-
func (o *ProjectOptions) getConfigPaths() ([]string, error) {
556-
if len(o.ConfigPaths) != 0 {
557-
return absolutePaths(o.ConfigPaths)
558-
}
559-
return nil, fmt.Errorf("no configuration file provided: %w", errdefs.ErrNotFound)
560-
}
561-
562552
func findFiles(names []string, pwd string) []string {
563553
candidates := []string{}
564554
for _, n := range names {

cli/options_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ func TestProjectName(t *testing.T) {
167167
})
168168

169169
t.Run("by COMPOSE_PROJECT_NAME", func(t *testing.T) {
170-
os.Setenv("COMPOSE_PROJECT_NAME", "my_project_from_env") //nolint:errcheck
171-
defer os.Unsetenv("COMPOSE_PROJECT_NAME") //nolint:errcheck
170+
err := os.Setenv("COMPOSE_PROJECT_NAME", "my_project_from_env")
171+
assert.NilError(t, err)
172+
defer os.Unsetenv("COMPOSE_PROJECT_NAME")
172173
opts, err := NewProjectOptions([]string{"testdata/simple/compose.yaml"}, WithOsEnv)
173174
assert.NilError(t, err)
174175
p, err := ProjectFromOptions(context.TODO(), opts)
@@ -254,7 +255,7 @@ services:
254255
os.Stdin = originalStdin
255256
}()
256257

257-
w.WriteString(composeData)
258+
_, _ = w.WriteString(composeData)
258259
w.Close()
259260

260261
os.Stdin = r

dotenv/godotenv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var startsWithDigitRegex = regexp.MustCompile(`^\s*\d.*`) // Keys starting with
3030
// LookupFn represents a lookup function to resolve variables from
3131
type LookupFn func(string) (string, bool)
3232

33-
var noLookupFn = func(s string) (string, bool) {
33+
var noLookupFn = func(_ string) (string, bool) {
3434
return "", false
3535
}
3636

dotenv/godotenv_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ func TestExpanding(t *testing.T) {
269269
}
270270
})
271271
}
272-
273272
}
274273

275274
func TestVariableStringValueSeparator(t *testing.T) {
@@ -470,7 +469,7 @@ func TestLinesToIgnore(t *testing.T) {
470469

471470
for n, c := range cases {
472471
t.Run(n, func(t *testing.T) {
473-
got := string(newParser().getStatementStart(c.input))
472+
got := newParser().getStatementStart(c.input)
474473
if got != c.want {
475474
t.Errorf("Expected:\t %q\nGot:\t %q", c.want, got)
476475
}
@@ -718,7 +717,7 @@ func TestLoadWithFormat(t *testing.T) {
718717
"ZOT": "QIX",
719718
}
720719

721-
custom := func(r io.Reader, f string, lookup func(key string) (string, bool)) (map[string]string, error) {
720+
custom := func(r io.Reader, _ string, lookup func(key string) (string, bool)) (map[string]string, error) {
722721
vars := map[string]string{}
723722
scanner := bufio.NewScanner(r)
724723
for scanner.Scan() {

dotenv/godotenv_var_expansion_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var envMap = map[string]string{
1414
"TEST_VAR": "Test Value",
1515
}
1616

17-
var notFoundLookup = func(s string) (string, bool) {
17+
var notFoundLookup = func(_ string) (string, bool) {
1818
return "", false
1919
}
2020

@@ -45,7 +45,7 @@ func TestExpandIfEmptyOrUnset(t *testing.T) {
4545
t.Run(expected.name, func(t *testing.T) {
4646
result, err := expandVariables(expected.input, envMap, notFoundLookup)
4747
require.NoError(t, err)
48-
assert.Equal(t, result, expected.result)
48+
assert.Equal(t, expected.result, result)
4949
})
5050
}
5151
}
@@ -77,7 +77,7 @@ func TestExpandIfUnset(t *testing.T) {
7777
t.Run(expected.name, func(t *testing.T) {
7878
result, err := expandVariables(expected.input, envMap, notFoundLookup)
7979
require.NoError(t, err)
80-
assert.Equal(t, result, expected.result)
80+
assert.Equal(t, expected.result, result)
8181
})
8282
}
8383
}

dotenv/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ loop:
115115
switch rune {
116116
case '=', ':', '\n':
117117
// library also supports yaml-style value declaration
118-
key = string(src[0:i])
118+
key = src[0:i]
119119
offset = i + 1
120120
inherited = rune == '\n'
121121
break loop
@@ -157,7 +157,7 @@ func (p *parser) extractVarValue(src string, envMap map[string]string, lookupFn
157157
// Remove inline comments on unquoted lines
158158
value, _, _ = strings.Cut(value, " #")
159159
value = strings.TrimRightFunc(value, unicode.IsSpace)
160-
retVal, err := expandVariables(string(value), envMap, lookupFn)
160+
retVal, err := expandVariables(value, envMap, lookupFn)
161161
return retVal, rest, err
162162
}
163163

dotenv/parser_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ func TestParseBytes(t *testing.T) {
3939
func TestParseVariable(t *testing.T) {
4040
err := newParser().parse("%!(EXTRA string)=foo", map[string]string{}, nil)
4141
assert.Error(t, err, "line 1: unexpected character \"%\" in variable name \"%!(EXTRA string)=foo\"")
42-
4342
}
4443

4544
func TestMemoryExplosion(t *testing.T) {

0 commit comments

Comments
 (0)