Skip to content

Commit

Permalink
Update CI workflow and drop slices for compatibility (#135)
Browse files Browse the repository at this point in the history
This PR

1. Update Go directive in `tools/go.mod` and `go.work` to 1.21. This is
OK because `tools` is not a public library.
2. Update `.golangci.yml` to exclude `gci` for `results.go`, because it
has trouble recognizing `slices` as a standard library (even with Go
1.21)
3. Update `make lint-go` and use it in ci.yaml, also add target `make
lint-go-fix`.
  • Loading branch information
oliversun9 authored Nov 21, 2023
1 parent d4541f4 commit 82d0df3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,4 @@ jobs:
- name: Test
run: make test
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
skip-pkg-cache: true
only-new-issues: true
args: >
--modules-download-mode=readonly
--timeout=3m0s
./tools/...
run: make lint-go
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ issues:
linters:
- gosec
- forbidigo
# gci is confused by "slices" and suggests to move it to the end of the import list
- path: tools/protovalidate-conformance/internal/results/result.go
linters:
- gci
# Building the conformance test suites
- path: tools/protovalidate-conformance/internal/cases/
linters:
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ lint: lint-proto lint-go ## Lint code and protos

.PHONY: lint-go
lint-go: $(BIN)/golangci-lint
$(BIN)/golangci-lint run ./tools/...
$(BIN)/golangci-lint run --modules-download-mode=readonly --timeout=3m0s ./tools/...

.PHONY: lint-go-fix
lint-go-fix: $(BIN)/golangci-lint
$(BIN)/golangci-lint run --fix --modules-download-mode=readonly --timeout=3m0s ./tools/...

.PHONY: lint-proto
lint-proto: $(BIN)/buf
Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.18
go 1.21

use (
./tools
Expand Down
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
Expand Down
2 changes: 1 addition & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/bufbuild/protovalidate/tools

go 1.18
go 1.21

require (
github.com/bufbuild/protocompile v0.6.0
Expand Down
1 change: 1 addition & 0 deletions tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand Down

0 comments on commit 82d0df3

Please sign in to comment.