Skip to content

Commit

Permalink
chore: upgrade go to 1.22.4 (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedhyw authored Jun 19, 2024
1 parent fda2b0c commit 50a25ce
Show file tree
Hide file tree
Showing 56 changed files with 911 additions and 4,547 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go.sum linguist-generated merge=ours
go.mod linguist-generated
vendor/* linguist-vendored
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21.4'
go-version: '1.22.4'
id: go

- name: Check out code into the Go module directory
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21.4'
go-version: '1.22.4'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
Expand Down
14 changes: 3 additions & 11 deletions .golangci.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"bodyclose",
"wsl",
"funlen",
"maligned",
"exhaustivestruct",
"gci",
"wrapcheck",
"varnamelen",
Expand All @@ -18,20 +16,14 @@
"thelper",
"paralleltest",
"tagliatelle",
"scopelint",
"golint",
"interfacer",
"nonamedreturns",
"exhaustruct",
"nolintlint",
"deadcode",
"wastedassign",
"structcheck",
"varcheck",
"ifshort",
"nosnakecase",
"rowserrcheck",
"depguard"
"depguard",
"mnd",
"execinquery"
]
},
"linters-settings": {
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG GOLANG_DOCKER_TAG=1.21.4-alpine3.18
ARG ALPINE_DOCKER_TAG=3.18
ARG GOLANG_DOCKER_TAG=1.22.4-alpine3.19
ARG ALPINE_DOCKER_TAG=3.19

FROM golang:$GOLANG_DOCKER_TAG as builder

Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GOLANG_CI_LINT_VER:=v1.53.2
GOLANG_CI_LINT_VER:=v1.59.1
OUT_BIN?=${PWD}/bin/gherkingen
COVER_PACKAGES=./...
VERSION?=${shell git describe --tags}
Expand All @@ -11,8 +11,8 @@ build:
cmd/gherkingen/main.go
.PHONY: build

lint: bin/golangci-lint
./bin/golangci-lint run
lint: bin/golangci-lint-${GOLANG_CI_LINT_VER}
./bin/golangci-lint-${GOLANG_CI_LINT_VER} run
.PHONY: lint

test:
Expand All @@ -37,8 +37,9 @@ vendor:
go mod vendor
.PHONY: vendor

bin/golangci-lint:
bin/golangci-lint-${GOLANG_CI_LINT_VER}:
curl \
-sSfL \
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s $(GOLANG_CI_LINT_VER)
mv ./bin/golangci-lint ./bin/golangci-lint-${GOLANG_CI_LINT_VER}
6 changes: 3 additions & 3 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions internal/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ func TestApplicationCommandLineTool(t *testing.T) {
}

for name, testCase := range testCases {
testCase := testCase

t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -62,7 +60,6 @@ func TestApplicationCommandLineTool(t *testing.T) {
}

for name, testCase := range testCases {
testCase := testCase
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand All @@ -87,8 +84,6 @@ func TestApplicationCommandLineTool(t *testing.T) {
}

for name, testCase := range testCases {
testCase := testCase

t.Run(name, func(t *testing.T) {
t.Parallel()

Expand All @@ -114,7 +109,6 @@ func TestApplicationCommandLineTool(t *testing.T) {
}

for name, testCase := range testCases {
testCase := testCase
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -147,8 +141,6 @@ func TestApplicationCommandLineToolCustom(t *testing.T) {
}

for name, testCase := range testCases {
testCase := testCase

t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -177,8 +169,6 @@ func TestApplicationCommandLineToolCustom(t *testing.T) {
}

for name, testCase := range testCases {
testCase := testCase

t.Run(name, func(t *testing.T) {
t.Parallel()

Expand All @@ -205,8 +195,6 @@ func TestApplicationCommandLineToolCustom(t *testing.T) {
}

for name, testCase := range testCases {
testCase := testCase

t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -263,8 +251,6 @@ func TestApplicationCommandLineToolFailures(t *testing.T) {
}

for name, testCase := range testCases {
testCase := testCase

t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
8 changes: 3 additions & 5 deletions internal/assets/assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ func TestOpenTemplate(t *testing.T) {
"std.simple.v1.go.tmpl",
}

for _, f := range files {
f := f

t.Run(f, func(t *testing.T) {
for _, file := range files {
t.Run(file, func(t *testing.T) {
t.Parallel()

f, err := assets.OpenTemplate(f)
f, err := assets.OpenTemplate(file)
require.NoError(t, err)

defer func() { assert.NoError(t, f.Close()) }()
Expand Down
20 changes: 8 additions & 12 deletions internal/docplugin/goplugin/goaliaser/goaliaser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ func TestStringValue(t *testing.T) {

p := goaliaser.New()

for i, tc := range testCases {
i, tc := i, tc

t.Run(tc.In, func(t *testing.T) {
for i, testCase := range testCases {
t.Run(testCase.In, func(t *testing.T) {
t.Parallel()

got := p.StringValue(tc.In)
assert.Equal(t, tc.Exp, got, i)
got := p.StringValue(testCase.In)
assert.Equal(t, testCase.Exp, got, i)
})
}
}
Expand Down Expand Up @@ -199,14 +197,12 @@ func TestNameAlias(t *testing.T) {

p := goaliaser.New()

for i, tc := range testCases {
i, tc := i, tc

t.Run(tc.In, func(t *testing.T) {
for i, testCase := range testCases {
t.Run(testCase.In, func(t *testing.T) {
t.Parallel()

got := p.NameAlias(tc.In)
assert.Equal(t, tc.Exp, got, i)
got := p.NameAlias(testCase.In)
assert.Equal(t, testCase.Exp, got, i)
})
}
}
4 changes: 2 additions & 2 deletions internal/docplugin/goplugin/goplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (p GoPlugin) walkStruct(
return fmt.Errorf("handling struct: %s: %w", rt.Name(), err)
}

for i := 0; i < rt.NumField(); i++ {
for i := range rt.NumField() {
if !rv.Field(i).CanInterface() {
continue
}
Expand All @@ -121,7 +121,7 @@ func (p GoPlugin) walkSlice(
) (err error) {
rt := rv.Type()

for i := 0; i < rv.Len(); i++ {
for i := range rv.Len() {
el := rv.Index(i)

if !el.CanInterface() {
Expand Down
16 changes: 7 additions & 9 deletions internal/docplugin/goplugin/goplugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func TestExample(t *testing.T) {

examples := make([]*model.TableRow, 0, count)

for i := 0; i < count; i++ {
for range count {
examples = append(examples, &model.TableRow{
Cells: []*model.TableCell{{
Value: "hello_world",
Expand Down Expand Up @@ -449,21 +449,19 @@ func TestParallel(t *testing.T) {

ctx := context.Background()

for _, tc := range [2]bool{true, false} {
tc := tc

t.Run(strconv.FormatBool(tc), func(t *testing.T) {
for _, testCase := range [2]bool{true, false} {
t.Run(strconv.FormatBool(testCase), func(t *testing.T) {
t.Parallel()

p := goplugin.New(goplugin.Args{
Parallel: tc,
Parallel: testCase,
})
doc := getExampleDocument()

if assert.NoError(t, p.Process(ctx, doc)) {
assert.Equal(t, tc, doc.Feature.PluginData["GoParallel"])
assert.Equal(t, tc, doc.Feature.Children[0].Scenario.PluginData["GoParallel"])
assert.Equal(t, tc, doc.Feature.Children[0].Rule.PluginData["GoParallel"])
assert.Equal(t, testCase, doc.Feature.PluginData["GoParallel"])
assert.Equal(t, testCase, doc.Feature.Children[0].Scenario.PluginData["GoParallel"])
assert.Equal(t, testCase, doc.Feature.Children[0].Rule.PluginData["GoParallel"])
}
})
}
Expand Down
26 changes: 11 additions & 15 deletions internal/docplugin/goplugin/gotype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ func TestDeterminateGoType(t *testing.T) {
Exp: goTypeString,
}}

for i, tc := range testCases {
i, tc := i, tc

t.Run(strings.Join(tc.In, "_"), func(t *testing.T) {
for i, testCase := range testCases {
t.Run(strings.Join(testCase.In, "_"), func(t *testing.T) {
t.Parallel()

got := determinateGoType(tc.In)
assert.Equal(t, tc.Exp, got, i)
got := determinateGoType(testCase.In)
assert.Equal(t, testCase.Exp, got, i)
})
}
}
Expand Down Expand Up @@ -123,19 +121,17 @@ func TestGoValue(t *testing.T) {
ExpGoType: goTypeFloat64,
}}

for i, tc := range testCases {
i, tc := i, tc

t.Run(string(tc.InGoType)+"_"+tc.In, func(t *testing.T) {
for i, testCase := range testCases {
t.Run(string(testCase.InGoType)+"_"+testCase.In, func(t *testing.T) {
t.Parallel()

gotVal, gotType := goValue(goaliaser.New(), tc.In, tc.InGoType)
if gotVal != tc.Exp {
t.Errorf("%d:\n\tin: %s\n\texp: %s\n\tgot: %s", i, tc.In, tc.Exp, gotVal)
gotVal, gotType := goValue(goaliaser.New(), testCase.In, testCase.InGoType)
if gotVal != testCase.Exp {
t.Errorf("%d:\n\tin: %s\n\texp: %s\n\tgot: %s", i, testCase.In, testCase.Exp, gotVal)
}

if gotType != tc.ExpGoType {
t.Errorf("%d:\n\tin: %s\n\texp: %s\n\tgot: %s", i, tc.In, tc.ExpGoType, gotType)
if gotType != testCase.ExpGoType {
t.Errorf("%d:\n\tin: %s\n\texp: %s\n\tgot: %s", i, testCase.In, testCase.ExpGoType, gotType)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hedhyw/gherkingen/v3/internal/docplugin"
"github.com/hedhyw/gherkingen/v3/internal/model"

gherkin "github.com/cucumber/common/gherkin/go/v24"
gherkin "github.com/cucumber/gherkin/go/v28"
"github.com/hedhyw/semerr/pkg/v1/semerr"
)

Expand Down
Loading

0 comments on commit 50a25ce

Please sign in to comment.