Skip to content

Commit 3311004

Browse files
authored
chore: add linter config file and fix findings (#196)
* chore: add lint config file and fix findings Signed-off-by: Sahid Velji <[email protected]> * chore: upgrade deps Signed-off-by: Sahid Velji <[email protected]> * chore: upgrade golangci-lint version Signed-off-by: Sahid Velji <[email protected]> --------- Signed-off-by: Sahid Velji <[email protected]>
1 parent 6cb2453 commit 3311004

34 files changed

Lines changed: 341 additions & 341 deletions

.github/workflows/pr-lint.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ jobs:
2424
fetch-depth: 0
2525
- uses: actions/setup-go@v5
2626
with:
27-
go-version-file: 'go.mod'
27+
go-version-file: "go.mod"
2828
- name: golangci-lint
29-
uses: golangci/golangci-lint-action@v6
29+
uses: golangci/golangci-lint-action@v9
3030
with:
31-
version: v1.64
32-
only-new-issues: true
31+
version: v2.7.1

.golangci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
version: "2"
3+
4+
formatters:
5+
enable:
6+
- gofumpt
7+
- gci
8+
9+
linters:
10+
default: none
11+
enable:
12+
- copyloopvar
13+
- dupword
14+
- errcheck
15+
- govet
16+
- ineffassign
17+
- intrange
18+
- misspell
19+
- modernize
20+
- staticcheck
21+
- unused
22+
- usetesting
23+
settings:
24+
staticcheck:
25+
checks:
26+
- all
27+
usetesting:
28+
context-background: true
29+
context-todo: true
30+
os-chdir: true
31+
os-mkdir-temp: true
32+
os-setenv: true
33+
os-temp-dir: true
34+
os-create-temp: true
35+
exclusions:
36+
generated: lax
37+
presets:
38+
- comments
39+
- std-error-handling
40+
41+
issues:
42+
max-issues-per-linter: 0
43+
max-same-issues: 0
44+
45+
run:
46+
timeout: 3m
47+
modules-download-mode: readonly
48+
49+
output:
50+
sort-order:
51+
- file

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ This tool is particularly helpful for new contributors or those returning to the
8686

8787
The pre-commit hook is configured to run the following check:
8888

89-
1. **Code Formatting**: Ensures all files are properly formatted using `go fmt`. Any changes made by `go fmt` will be automatically staged.
89+
1. **Code Formatting**: Ensures all files are properly formatted using `golangci-lint fmt`. Any changes made by `golangci-lint fmt` will be automatically staged.
9090

9191
### Pre-Push Hook
9292

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,28 @@ generate: generate-api generate-docs generate-schema
8585

8686
.PHONY: fmt
8787
fmt:
88-
@echo "Running go fmt..."
89-
@go fmt ./...
88+
@echo "Running golangci-lint fmt..."
89+
@golangci-lint fmt
9090
@echo "Code formatted successfully!"
9191

9292
.PHONY: lint
9393
lint:
9494
@echo "Running golangci-lint..."
9595
@if ! command -v golangci-lint &> /dev/null; then \
9696
echo "Installing golangci-lint..."; \
97-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.0; \
97+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.7.1; \
9898
fi
99-
@golangci-lint run ./...
99+
@golangci-lint run
100100
@echo "Linting completed successfully!"
101101

102102
.PHONY: lint-fix
103103
lint-fix:
104104
@echo "Running golangci-lint with auto-fix..."
105105
@if ! command -v golangci-lint &> /dev/null; then \
106106
echo "Installing golangci-lint..."; \
107-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.0; \
107+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.7.1; \
108108
fi
109-
@golangci-lint run --fix ./...
109+
@golangci-lint run --fix
110110
@echo "Linting with auto-fix completed successfully!"
111111

112112
.PHONY: verify-generate
@@ -121,4 +121,4 @@ verify-generate: generate
121121

122122
.PHONY: ci
123123
ci: lint test verify-generate
124-
@echo "All CI checks passed successfully!"
124+
@echo "All CI checks passed successfully!"

docs/generate-commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func processCommandFile(cmd *cobra.Command, filePath string) {
109109

110110
// Only write the file if content was modified
111111
if modifiedContent != string(content) {
112-
err = os.WriteFile(filePath, []byte(modifiedContent), 0644)
112+
err = os.WriteFile(filePath, []byte(modifiedContent), 0o644)
113113
if err != nil {
114114
fmt.Fprintf(os.Stderr, "error writing file %s: %v\n", filePath, err)
115115
}

go.mod

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,39 @@ go 1.24.0
55
toolchain go1.24.1
66

77
require (
8-
dagger.io/dagger v0.19.0
8+
dagger.io/dagger v0.19.8
99
github.com/google/go-cmp v0.7.0
1010
github.com/h2non/gock v1.2.0
1111
github.com/iancoleman/strcase v0.3.0
1212
github.com/invopop/jsonschema v0.13.0
1313
github.com/kriscoleman/GoRetry v0.0.1
1414
github.com/oapi-codegen/runtime v1.1.2
15-
github.com/pterm/pterm v0.12.81
16-
github.com/spf13/afero v1.14.0
17-
github.com/spf13/cobra v1.9.1
18-
github.com/spf13/pflag v1.0.6
19-
github.com/spf13/viper v1.20.1
15+
github.com/pterm/pterm v0.12.82
16+
github.com/spf13/afero v1.15.0
17+
github.com/spf13/cobra v1.10.2
18+
github.com/spf13/pflag v1.0.10
19+
github.com/spf13/viper v1.21.0
2020
github.com/stretchr/testify v1.11.1
2121
github.com/xeipuuv/gojsonschema v1.2.0
22-
golang.org/x/term v0.35.0
23-
golang.org/x/text v0.29.0
24-
golang.org/x/tools v0.37.0
22+
golang.org/x/term v0.37.0
23+
golang.org/x/text v0.31.0
24+
golang.org/x/tools v0.39.0
2525
gopkg.in/yaml.v3 v3.0.1
2626
)
2727

2828
require (
2929
atomicgo.dev/cursor v0.2.0 // indirect
3030
atomicgo.dev/keyboard v0.2.9 // indirect
3131
atomicgo.dev/schedule v0.1.0 // indirect
32-
github.com/99designs/gqlgen v0.17.80 // indirect
32+
github.com/99designs/gqlgen v0.17.84 // indirect
3333
github.com/Khan/genqlient v0.8.1 // indirect
3434
github.com/adrg/xdg v0.5.3 // indirect
3535
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
3636
github.com/bahlo/generic-list-go v0.2.0 // indirect
3737
github.com/buger/jsonparser v1.1.1 // indirect
3838
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
39+
github.com/clipperhouse/stringish v0.1.1 // indirect
40+
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
3941
github.com/containerd/console v1.0.5 // indirect
4042
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
4143
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -44,29 +46,27 @@ require (
4446
github.com/go-logr/stdr v1.2.2 // indirect
4547
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
4648
github.com/google/uuid v1.6.0 // indirect
47-
github.com/gookit/color v1.5.4 // indirect
48-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
49+
github.com/gookit/color v1.6.0 // indirect
50+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
4951
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
5052
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5153
github.com/lithammer/fuzzysearch v1.1.8 // indirect
52-
github.com/mailru/easyjson v0.9.0 // indirect
53-
github.com/mattn/go-runewidth v0.0.16 // indirect
54+
github.com/mailru/easyjson v0.9.1 // indirect
55+
github.com/mattn/go-runewidth v0.0.19 // indirect
5456
github.com/mitchellh/go-homedir v1.1.0 // indirect
5557
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
5658
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
57-
github.com/rivo/uniseg v0.4.7 // indirect
5859
github.com/russross/blackfriday/v2 v2.1.0 // indirect
59-
github.com/sagikazarmark/locafero v0.9.0 // indirect
60+
github.com/sagikazarmark/locafero v0.12.0 // indirect
6061
github.com/sosodev/duration v1.3.1 // indirect
61-
github.com/sourcegraph/conc v0.3.0 // indirect
62-
github.com/spf13/cast v1.8.0 // indirect
62+
github.com/spf13/cast v1.10.0 // indirect
6363
github.com/subosito/gotenv v1.6.0 // indirect
64-
github.com/vektah/gqlparser/v2 v2.5.30 // indirect
64+
github.com/vektah/gqlparser/v2 v2.5.31 // indirect
6565
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
6666
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
6767
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
6868
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
69-
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
69+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
7070
go.opentelemetry.io/otel v1.38.0 // indirect
7171
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 // indirect
7272
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.14.0 // indirect
@@ -81,15 +81,15 @@ require (
8181
go.opentelemetry.io/otel/sdk/log v0.14.0 // indirect
8282
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
8383
go.opentelemetry.io/otel/trace v1.38.0 // indirect
84-
go.opentelemetry.io/proto/otlp v1.8.0 // indirect
85-
go.uber.org/multierr v1.11.0 // indirect
84+
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
85+
go.yaml.in/yaml/v3 v3.0.4 // indirect
8686
golang.org/x/exp v0.0.0-20250530174510-65e920069ea6 // indirect
87-
golang.org/x/mod v0.28.0 // indirect
88-
golang.org/x/net v0.44.0 // indirect
89-
golang.org/x/sync v0.17.0 // indirect
90-
golang.org/x/sys v0.36.0 // indirect
91-
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
92-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
93-
google.golang.org/grpc v1.75.1 // indirect
94-
google.golang.org/protobuf v1.36.9 // indirect
87+
golang.org/x/mod v0.30.0 // indirect
88+
golang.org/x/net v0.47.0 // indirect
89+
golang.org/x/sync v0.18.0 // indirect
90+
golang.org/x/sys v0.38.0 // indirect
91+
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
92+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
93+
google.golang.org/grpc v1.77.0 // indirect
94+
google.golang.org/protobuf v1.36.10 // indirect
9595
)

0 commit comments

Comments
 (0)