Skip to content

Commit 4d4b741

Browse files
authored
Merge pull request #229 from ndeloof/lint-action
use golangci-lint action
2 parents be12d6c + 48546e0 commit 4d4b741

File tree

9 files changed

+12
-17
lines changed

9 files changed

+12
-17
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- name: Checkout
1010
uses: actions/checkout@v2
1111
- name: Lint code
12-
run: DOCKER_BUILDKIT=1 make lint
12+
uses: golangci/golangci-lint-action@v2
1313
- name: Check license
1414
run: DOCKER_BUILDKIT=1 make check-license
1515

ci/Dockerfile

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

1717
WORKDIR /go/src
1818

19-
ARG GOLANGCILINT_VERSION=v1.24.0
19+
ARG GOLANGCILINT_VERSION=v1.44.1
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 get -v -u github.com/kunalkushwaha/ltag && rm -rf /go/src/github.com/kunalkushwaha
2222

cli/options_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ func TestProjectName(t *testing.T) {
115115
})
116116

117117
t.Run("by COMPOSE_PROJECT_NAME", func(t *testing.T) {
118-
os.Setenv("COMPOSE_PROJECT_NAME", "my_project_from_env")
119-
defer os.Unsetenv("COMPOSE_PROJECT_NAME")
118+
os.Setenv("COMPOSE_PROJECT_NAME", "my_project_from_env") //nolint:errcheck
119+
defer os.Unsetenv("COMPOSE_PROJECT_NAME") //nolint:errcheck
120120
opts, err := NewProjectOptions([]string{"testdata/simple/compose.yaml"}, WithOsEnv)
121121
assert.NilError(t, err)
122122
p, err := ProjectFromOptions(opts)
@@ -129,7 +129,7 @@ func TestProjectName(t *testing.T) {
129129
assert.NilError(t, err)
130130
err = os.Chdir("testdata/env-file")
131131
assert.NilError(t, err)
132-
defer os.Chdir(wd)
132+
defer os.Chdir(wd) //nolint:errcheck
133133

134134
opts, err := NewProjectOptions(nil, WithDotEnv, WithConfigFileEnv)
135135
assert.NilError(t, err)
@@ -186,7 +186,7 @@ func TestProjectWithDotEnv(t *testing.T) {
186186
assert.NilError(t, err)
187187
err = os.Chdir("testdata/simple")
188188
assert.NilError(t, err)
189-
defer os.Chdir(wd)
189+
defer os.Chdir(wd) //nolint:errcheck
190190

191191
opts, err := NewProjectOptions([]string{
192192
"compose-with-variables.yaml",

golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ linters:
66
enable:
77
- gofmt
88
- goimports
9-
- golint
9+
- revive
1010
- gosimple
1111
- ineffassign
1212
- misspell

interpolation/interpolation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func newPathError(path Path, err error) error {
115115
return nil
116116
case *template.InvalidTemplateError:
117117
return errors.Errorf(
118-
"invalid interpolation format for %s: %#v. You may need to escape any $ with another $.",
118+
"invalid interpolation format for %s: %#v. You may need to escape any $ with another $",
119119
path, err.Template)
120120
default:
121121
return errors.Wrapf(err, "error while interpolating %s", path)

interpolation/interpolation_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func TestInvalidInterpolation(t *testing.T) {
7474
},
7575
}
7676
_, err := Interpolate(services, Options{LookupValue: defaultMapping})
77-
assert.Error(t, err, `invalid interpolation format for servicea.image: "${". You may need to escape any $ with another $.`)
77+
assert.Error(t, err, `invalid interpolation format for servicea.image: "${". You may need to escape any $ with another $`)
7878
}
7979

8080
func TestInterpolateWithDefaults(t *testing.T) {
@@ -133,7 +133,7 @@ func TestValidUnexistentInterpolation(t *testing.T) {
133133

134134
getFullErrorMsg := func(msg string) string {
135135
return fmt.Sprintf("invalid interpolation format for myservice.environment.TESTVAR: "+
136-
"\"required variable FOO is missing a value: %s\". You may need to escape any $ with another $.", msg)
136+
"\"required variable FOO is missing a value: %s\". You may need to escape any $ with another $", msg)
137137
}
138138

139139
for _, testcase := range testcases {

loader/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ var transformDependsOnConfig TransformerFunc = func(data interface{}) (interface
887887
for _, serviceIntf := range value {
888888
service, ok := serviceIntf.(string)
889889
if !ok {
890-
return data, errors.Errorf("invalid type %T for service depends_on element. Expected string.", value)
890+
return data, errors.Errorf("invalid type %T for service depends_on elementn, expected string", value)
891891
}
892892
transformed[service] = map[string]interface{}{"condition": types.ServiceConditionStarted}
893893
}

loader/normalize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func normalize(project *types.Project, resolvePaths bool) error {
7979
if resolvePaths {
8080
s.Build.Context = localContext
8181
}
82-
} else {
82+
// } else {
8383
// might be a remote http/git context. Unfortunately supported "remote" syntax is highly ambiguous
8484
// in moby/moby and not defined by compose-spec, so let's assume runtime will check
8585
}

schema/schema.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ import (
2727
_ "embed"
2828
)
2929

30-
const (
31-
defaultVersion = "1.0"
32-
versionField = "version"
33-
)
34-
3530
type portsFormatChecker struct{}
3631

3732
func (checker portsFormatChecker) IsFormat(input interface{}) bool {

0 commit comments

Comments
 (0)