Skip to content

Commit fba76f1

Browse files
core(deps): bump golang-cilint to v2.0.2 (#83)
1 parent 4be22e9 commit fba76f1

38 files changed

+184
-174
lines changed

.github/actions/choco/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM alpine:3.17
1+
FROM alpine:3.21
22

33
ARG CHOCOVERSION=1.1.0
44

55
RUN apk add --no-cache bash ca-certificates git \
6-
&& apk --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing add mono mono-dev \
6+
&& apk --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community add mono mono-dev \
77
&& cert-sync /etc/ssl/certs/ca-certificates.crt \
88
&& wget "https://github.com/chocolatey/choco/archive/${CHOCOVERSION}.tar.gz" -O- | tar -xzf - \
99
&& cd choco-"${CHOCOVERSION}" \

.github/workflows/checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
with:
2323
go-version-file: go.mod
2424
check-latest: true
25-
- uses: golangci/golangci-lint-action@v6.5.0
25+
- uses: golangci/golangci-lint-action@v7.0.0
2626
with:
27-
version: v1.64.8
27+
version: v2.0.2
2828
- uses: megalinter/megalinter/flavors/[email protected]
2929
env:
3030
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}

.golangci.yml

Lines changed: 58 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,65 @@
1-
# Minimum golangci-lint version required: v1.46.0
2-
run:
3-
timeout: 3m
4-
5-
issues:
6-
exclude-dirs:
7-
- report # megalinter results+fixes
8-
max-issues-per-linter: 0
9-
max-same-issues: 0
10-
11-
linters-settings:
12-
gocyclo:
13-
# minimal code complexity to report, 30 by default (but we recommend 10-20)
14-
min-complexity: 20
15-
gocritic:
16-
disabled-checks:
17-
- ifElseChain
18-
importas:
19-
alias:
20-
- pkg: 'github.com/sirupsen/logrus'
21-
alias: log
22-
- pkg: 'github.com/stretchr/testify/assert'
23-
alias: assert
24-
depguard:
25-
rules:
26-
main:
27-
deny:
28-
- pkg: github.com/pkg/errors
29-
desc: Please use "errors" package from standard library
30-
- pkg: gotest.tools/v3
31-
desc: Please keep tests unified using only github.com/stretchr/testify
32-
- pkg: log
33-
desc: Please keep logging unified using only github.com/sirupsen/logrus
1+
version: "2"
342
linters:
353
enable:
36-
- gosimple
37-
- staticcheck
38-
- unused
39-
- govet
40-
- revive
41-
- gocyclo
42-
- gosec
43-
- unconvert
44-
- dupl
45-
- nakedret
46-
- prealloc
4+
- contextcheck
475
- copyloopvar
48-
- gocritic
49-
- goimports
50-
- whitespace
51-
- misspell
526
- depguard
7+
- dupl
8+
- gocritic
9+
- gocyclo
10+
- gosec
5311
- importas
54-
- contextcheck
12+
- misspell
13+
- nakedret
5514
- nolintlint
15+
- prealloc
5616
- revive
17+
- unconvert
18+
- whitespace
19+
settings:
20+
depguard:
21+
rules:
22+
main:
23+
deny:
24+
- pkg: github.com/pkg/errors
25+
desc: Please use "errors" package from standard library
26+
- pkg: gotest.tools/v3
27+
desc: Please keep tests unified using only github.com/stretchr/testify
28+
- pkg: log
29+
desc: Please keep logging unified using only github.com/sirupsen/logrus
30+
gocritic:
31+
disabled-checks:
32+
- ifElseChain
33+
gocyclo:
34+
min-complexity: 20
35+
importas:
36+
alias:
37+
- pkg: github.com/sirupsen/logrus
38+
alias: log
39+
- pkg: github.com/stretchr/testify/assert
40+
alias: assert
41+
exclusions:
42+
generated: lax
43+
presets:
44+
- comments
45+
- common-false-positives
46+
- legacy
47+
- std-error-handling
48+
paths:
49+
- report
50+
- third_party$
51+
- builtin$
52+
- examples$
53+
issues:
54+
max-issues-per-linter: 0
55+
max-same-issues: 0
56+
formatters:
57+
enable:
58+
- goimports
59+
exclusions:
60+
generated: lax
61+
paths:
62+
- report
63+
- third_party$
64+
- builtin$
65+
- examples$

cmd/execute_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ func testMain(args []string) (exitCode int) {
3333
func TestMainHelp(t *testing.T) {
3434
exitCode := testMain([]string{"cmd", "--help"})
3535
if exitCode != 0 {
36-
t.Errorf("Expected exit code 0, got %d", exitCode)
36+
t.Errorf("expected exit code 0, got %d", exitCode)
3737
}
3838
}
3939

4040
func TestMainNoArgsError(t *testing.T) {
4141
exitCode := testMain([]string{"cmd"})
4242
if exitCode != 1 {
43-
t.Errorf("Expected exit code 1, got %d", exitCode)
43+
t.Errorf("expected exit code 1, got %d", exitCode)
4444
}
4545
}

cmd/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func readArgsFile(file string, split bool) []string {
280280
defer func() {
281281
err := f.Close()
282282
if err != nil {
283-
log.Errorf("Failed to close args file: %v", err)
283+
log.Errorf("failed to close args file: %v", err)
284284
}
285285
}()
286286
scanner := bufio.NewScanner(f)
@@ -555,7 +555,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
555555
}
556556
if plan != nil {
557557
if len(plan.Stages) == 0 {
558-
plannerErr = fmt.Errorf("Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name")
558+
plannerErr = fmt.Errorf("could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name")
559559
}
560560
}
561561
if plan == nil && plannerErr != nil {

cmd/secrets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func newSecrets(secretList []string) secrets {
1717
secretPairParts := strings.SplitN(secretPair, "=", 2)
1818
secretPairParts[0] = strings.ToUpper(secretPairParts[0])
1919
if strings.ToUpper(s[secretPairParts[0]]) == secretPairParts[0] {
20-
log.Errorf("Secret %s is already defined (secrets are case insensitive)", secretPairParts[0])
20+
log.Errorf("secret %s is already defined (secrets are case insensitive)", secretPairParts[0])
2121
}
2222
if len(secretPairParts) == 2 {
2323
s[secretPairParts[0]] = secretPairParts[1]

pkg/artifacts/arifacts_v4.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (r artifactV4Routes) buildSignature(endp, expires, artifactName string, tas
203203
mac.Write([]byte(endp))
204204
mac.Write([]byte(expires))
205205
mac.Write([]byte(artifactName))
206-
mac.Write([]byte(fmt.Sprint(taskID)))
206+
fmt.Fprint(mac, taskID)
207207
return mac.Sum(nil)
208208
}
209209

@@ -240,13 +240,13 @@ func (r artifactV4Routes) verifySignature(ctx *ArtifactContext, endp string) (in
240240
func (r *artifactV4Routes) parseProtbufBody(ctx *ArtifactContext, req protoreflect.ProtoMessage) bool {
241241
body, err := io.ReadAll(ctx.Req.Body)
242242
if err != nil {
243-
log.Errorf("Error decode request body: %v", err)
243+
log.Errorf("error decode request body: %v", err)
244244
ctx.Error(http.StatusInternalServerError, "Error decode request body")
245245
return false
246246
}
247247
err = protojson.Unmarshal(body, req)
248248
if err != nil {
249-
log.Errorf("Error decode request body: %v", err)
249+
log.Errorf("error decode request body: %v", err)
250250
ctx.Error(http.StatusInternalServerError, "Error decode request body")
251251
return false
252252
}
@@ -256,7 +256,7 @@ func (r *artifactV4Routes) parseProtbufBody(ctx *ArtifactContext, req protorefle
256256
func (r *artifactV4Routes) sendProtbufBody(ctx *ArtifactContext, req protoreflect.ProtoMessage) {
257257
resp, err := protojson.Marshal(req)
258258
if err != nil {
259-
log.Errorf("Error encode response body: %v", err)
259+
log.Errorf("error encode response body: %v", err)
260260
ctx.Error(http.StatusInternalServerError, "Error encode response body")
261261
return
262262
}
@@ -318,11 +318,11 @@ func (r *artifactV4Routes) uploadArtifact(ctx *ArtifactContext) {
318318

319319
writer, ok := file.(io.Writer)
320320
if !ok {
321-
panic(errors.New("File is not writable"))
321+
panic(errors.New("file is not writable"))
322322
}
323323

324324
if ctx.Req.Body == nil {
325-
panic(errors.New("No body given"))
325+
panic(errors.New("no body given"))
326326
}
327327

328328
_, err = io.Copy(writer, ctx.Req.Body)

pkg/artifacts/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ func uploads(router *httprouter.Router, baseDir string, fsys WriteFS) {
135135

136136
writer, ok := file.(io.Writer)
137137
if !ok {
138-
panic(errors.New("File is not writable"))
138+
panic(errors.New("file is not writable"))
139139
}
140140

141141
if req.Body == nil {
142-
panic(errors.New("No body given"))
142+
panic(errors.New("no body given"))
143143
}
144144

145145
_, err = io.Copy(writer, req.Body)
@@ -310,7 +310,7 @@ func Serve(ctx context.Context, artifactPath string, addr string, port string) c
310310
<-serverContext.Done()
311311

312312
if err := server.Shutdown(ctx); err != nil {
313-
logger.Errorf("Failed shutdown gracefully - force shutdown: %v", err)
313+
logger.Errorf("failed shutdown gracefully - force shutdown: %v", err)
314314
server.Close()
315315
}
316316
}()

pkg/common/executor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (e Executor) Finally(finally Executor) Executor {
227227
defer func() {
228228
err2 := finally(ctx)
229229
if err2 != nil {
230-
err = fmt.Errorf("Error occurred running finally: %v (original error: %v)", err2, err)
230+
err = fmt.Errorf("error occurred running finally: %v (original error: %v)", err2, err)
231231
}
232232
}()
233233
err = e(ctx)

pkg/common/git/git.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func FindGitRevision(ctx context.Context, file string) (shortSha string, sha str
7474
}
7575

7676
if head.Hash().IsZero() {
77-
return "", "", fmt.Errorf("HEAD sha1 could not be resolved")
77+
return "", "", fmt.Errorf("head sha1 could not be resolved")
7878
}
7979

8080
hash := head.Hash().String()
@@ -261,7 +261,7 @@ func CloneIfRequired(ctx context.Context, refName plumbing.ReferenceName, input
261261
} else if lgr, ok := logger.(*log.Logger); ok {
262262
progressWriter = lgr.WriterLevel(log.DebugLevel)
263263
} else {
264-
log.Errorf("Unable to get writer from logger (type=%T)", logger)
264+
log.Errorf("unable to get writer from logger (type=%T)", logger)
265265
progressWriter = os.Stdout
266266
}
267267
}
@@ -279,7 +279,7 @@ func CloneIfRequired(ctx context.Context, refName plumbing.ReferenceName, input
279279

280280
r, err = git.PlainCloneContext(ctx, input.Dir, false, &cloneOptions)
281281
if err != nil {
282-
logger.Errorf("Unable to clone %v %s: %v", input.URL, refName, err)
282+
logger.Errorf("unable to clone %v %s: %v", input.URL, refName, err)
283283
return nil, err
284284
}
285285

@@ -340,7 +340,7 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor {
340340
var hash *plumbing.Hash
341341
rev := plumbing.Revision(input.Ref)
342342
if hash, err = r.ResolveRevision(rev); err != nil {
343-
logger.Errorf("Unable to resolve %s: %v", input.Ref, err)
343+
logger.Errorf("unable to resolve %s: %v", input.Ref, err)
344344
}
345345

346346
if hash.String() != input.Ref && len(input.Ref) >= 4 && strings.HasPrefix(hash.String(), input.Ref) {
@@ -369,7 +369,7 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor {
369369
}
370370

371371
if hash, err = r.ResolveRevision(rev); err != nil {
372-
logger.Errorf("Unable to resolve %s: %v", input.Ref, err)
372+
logger.Errorf("unable to resolve %s: %v", input.Ref, err)
373373
return err
374374
}
375375

@@ -390,7 +390,7 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor {
390390
Branch: sourceRef,
391391
Force: true,
392392
}); err != nil {
393-
logger.Errorf("Unable to checkout %s: %v", sourceRef, err)
393+
logger.Errorf("unable to checkout %s: %v", sourceRef, err)
394394
return err
395395
}
396396
}
@@ -404,23 +404,23 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor {
404404
if hash.String() != input.Ref && refType == "branch" {
405405
logger.Debugf("Provided ref is not a sha. Updating branch ref after pull")
406406
if hash, err = r.ResolveRevision(rev); err != nil {
407-
logger.Errorf("Unable to resolve %s: %v", input.Ref, err)
407+
logger.Errorf("unable to resolve %s: %v", input.Ref, err)
408408
return err
409409
}
410410
}
411411
if err = w.Checkout(&git.CheckoutOptions{
412412
Hash: *hash,
413413
Force: true,
414414
}); err != nil {
415-
logger.Errorf("Unable to checkout %s: %v", *hash, err)
415+
logger.Errorf("unable to checkout %s: %v", *hash, err)
416416
return err
417417
}
418418

419419
if err = w.Reset(&git.ResetOptions{
420420
Mode: git.HardReset,
421421
Commit: *hash,
422422
}); err != nil {
423-
logger.Errorf("Unable to reset to %s: %v", hash.String(), err)
423+
logger.Errorf("unable to reset to %s: %v", hash.String(), err)
424424
return err
425425
}
426426

0 commit comments

Comments
 (0)