Skip to content

Commit

Permalink
refactor: use errors.Join, update dependencies and go to 1.20.1 (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedhyw authored Mar 1, 2023
1 parent a100623 commit 4093b88
Show file tree
Hide file tree
Showing 15 changed files with 349 additions and 220 deletions.
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@v3
with:
go-version: '1.19.2'
go-version: '1.20.1'
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@v3
with:
go-version: '1.19.2'
go-version: '1.20.1'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
Expand Down
9 changes: 8 additions & 1 deletion .golangci.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
"interfacer",
"nonamedreturns",
"exhaustruct",
"nolintlint"
"nolintlint",
"deadcode",
"wastedassign",
"structcheck",
"varcheck",
"ifshort",
"nosnakecase",
"rowserrcheck"
]
},
"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.19.2-alpine3.15
ARG ALPINE_DOCKER_TAG=3.15
ARG GOLANG_DOCKER_TAG=1.20.1-alpine3.17
ARG ALPINE_DOCKER_TAG=3.17

FROM golang:$GOLANG_DOCKER_TAG as builder

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GOLANG_CI_LINT_VER:=v1.50.1
GOLANG_CI_LINT_VER:=v1.51.2
OUT_BIN?=${PWD}/bin/gherkingen
COVER_PACKAGES=./...
VERSION?=${shell git describe --tags}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/hedhyw/gherkingen/v2

go 1.19
go 1.20

require (
github.com/cucumber/common/gherkin/go/v24 v24.1.0
Expand All @@ -13,7 +13,7 @@ require (

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gofrs/uuid v4.3.0+incompatible // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc=
github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hedhyw/semerr v0.5.2 h1:6IY13SNL+3uV0Fv6ebJAxLdKnqgvjC+Zgos7w0L66CQ=
Expand Down
7 changes: 3 additions & 4 deletions internal/app/readers.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package app

import (
"errors"
"fmt"
"io"
"os"
"strings"

"github.com/hedhyw/gherkingen/v2/internal/assets"

"github.com/hedhyw/semerr/pkg/v1/semerr"
)

func readInput(inputFile string) (data []byte, err error) {
Expand All @@ -23,7 +22,7 @@ func readInput(inputFile string) (data []byte, err error) {
return nil, fmt.Errorf("opening gherkin: %w", err)
}

defer func() { err = semerr.NewMultiError(err, f.Close()) }()
defer func() { err = errors.Join(err, f.Close()) }()

return io.ReadAll(f)
}
Expand All @@ -42,7 +41,7 @@ func readTemplate(template string) (data []byte, err error) {
return nil, fmt.Errorf("opening template: %w", err)
}

defer func() { err = semerr.NewMultiError(err, f.Close()) }()
defer func() { err = errors.Join(err, f.Close()) }()

return io.ReadAll(f)
}
4 changes: 2 additions & 2 deletions vendor/github.com/gofrs/uuid/README.md

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

Loading

0 comments on commit 4093b88

Please sign in to comment.