From fd90800ccea65c1d34a866057c86b5a7ae681ea5 Mon Sep 17 00:00:00 2001 From: Nicholas Wiersma Date: Wed, 20 Mar 2024 18:13:52 +0200 Subject: [PATCH] chore: bump golangci-lint to v1.57.0 (#365) --- .github/workflows/test.yml | 3 +-- cmd/avrogen/main.go | 5 +++-- registry/decoder.go | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebe86998..7c55fae9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: go-version: [ "1.21", "1.22" ] runs-on: ubuntu-latest env: - GOLANGCI_LINT_VERSION: v1.55.2 + GOLANGCI_LINT_VERSION: v1.57.0 steps: - name: Install Go @@ -38,7 +38,6 @@ jobs: with: version: ${{ env.GOLANGCI_LINT_VERSION }} skip-pkg-cache: true - args: --go ${{ matrix.go-version }} - name: Run tests run: go test -covermode=count -coverprofile=coverage.out ./... diff --git a/cmd/avrogen/main.go b/cmd/avrogen/main.go index 3d4cbe8c..6b175213 100644 --- a/cmd/avrogen/main.go +++ b/cmd/avrogen/main.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "errors" "flag" "fmt" "go/format" @@ -111,11 +112,11 @@ func realMain(args []string, stdout, stderr io.Writer) int { func validateOpts(nargs int, cfg config) error { if nargs < 1 { - return fmt.Errorf("at least one schema is required") + return errors.New("at least one schema is required") } if cfg.Pkg == "" { - return fmt.Errorf("a package is required") + return errors.New("a package is required") } return nil diff --git a/registry/decoder.go b/registry/decoder.go index 329ebdda..1d605ef2 100644 --- a/registry/decoder.go +++ b/registry/decoder.go @@ -3,6 +3,7 @@ package registry import ( "context" "encoding/binary" + "errors" "fmt" "github.com/hamba/avro/v2" @@ -43,7 +44,7 @@ func NewDecoder(client *Client, opts ...DecoderFunc) *Decoder { // https://docs.confluent.io/3.2.0/schema-registry/docs/serializer-formatter.html#wire-format. func (d *Decoder) Decode(ctx context.Context, data []byte, v any) error { if len(data) < 6 { - return fmt.Errorf("data too short") + return errors.New("data too short") } id, err := extractSchemaID(data) @@ -61,7 +62,7 @@ func (d *Decoder) Decode(ctx context.Context, data []byte, v any) error { func extractSchemaID(data []byte) (int, error) { if len(data) < 5 { - return 0, fmt.Errorf("data too short") + return 0, errors.New("data too short") } if data[0] != 0 { return 0, fmt.Errorf("invalid magic byte: %x", data[0])