From bd964cec358cf229488b9c16a5f1b1431c54da55 Mon Sep 17 00:00:00 2001 From: Lars de Bruijn <9264036+ldebruijn@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:30:13 +0100 Subject: [PATCH] feat(go-1.23): Update version (#116) Update go version to 1.23 Update golangci-lint to 1.60.1 Co-authored-by: ldebruijn --- .github/workflows/container-image.yml | 2 +- .github/workflows/go.yml | 2 +- .github/workflows/golangci-lint.yml | 4 ++-- Dockerfile | 2 +- README.md | 2 +- docs/run/docker.md | 2 +- docs/run/kubernetes.md | 2 +- go.mod | 2 +- internal/business/protect/protect.go | 2 +- internal/business/rules/aliases/aliases.go | 4 +--- internal/business/rules/max_depth/max_depth.go | 4 +--- makefile | 1 + 12 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/container-image.yml b/.github/workflows/container-image.yml index 1de3019..9e2ce45 100644 --- a/.github/workflows/container-image.yml +++ b/.github/workflows/container-image.yml @@ -33,7 +33,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21' + go-version: '1.23' - name: Build run: make VERSION=${{ github.event.release.tag_name }} build diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b89ed6a..7fc021d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.22' + go-version: '1.23' - name: Build run: make build diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 03023dd..216499a 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: - go-version: '1.22' + go-version: '1.23' cache: false - name: golangci-lint uses: golangci/golangci-lint-action@v3 @@ -28,7 +28,7 @@ jobs: # Require: The version of golangci-lint to use. # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. - version: v1.55.2 + version: v1.60.1 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/Dockerfile b/Dockerfile index 10e1889..f216be7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG VERSION ARG REVISION LABEL org.opencontainers.image.title=graphql-protect \ - org.opencontainers.image.description="A dead-simple yet highly customizable security sidecar compatible with any HTTP GraphQL Server or Gateway." \ + org.opencontainers.image.description="A dead-simple yet highly customizable security proxy compatible with any HTTP GraphQL Server or Gateway." \ org.opencontainers.image.created=$BUILD_DATE \ org.opencontainers.image.authors=ldebruijn \ org.opencontainers.image.url=https://github.com/ldebruijn/graphql-protect \ diff --git a/README.md b/README.md index 0cbc12e..c403fa8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # GraphQL Protect 🛡️ -GraphQL Protect is dead-simple yet highly customizable security sidecar compatible with any HTTP GraphQL Server or Gateway. +GraphQL Protect is dead-simple yet highly customizable security proxy compatible with any HTTP GraphQL Server or Gateway. ![GraphQL Protect Banner](docs/assets/banner.jpeg?raw=true) diff --git a/docs/run/docker.md b/docs/run/docker.md index fb42fba..d5f49fa 100644 --- a/docs/run/docker.md +++ b/docs/run/docker.md @@ -1,6 +1,6 @@ # Docker -GraphQL Protect is intended to run as sidecar to your main application. This allows it to scale with your application, and enjoys the benefit of loopback networking. +GraphQL Protect is intended to run as proxy to your main application. This allows it to scale with your application, and enjoys the benefit of loopback networking. ## Setting up diff --git a/docs/run/kubernetes.md b/docs/run/kubernetes.md index d3f7d97..0e62afc 100644 --- a/docs/run/kubernetes.md +++ b/docs/run/kubernetes.md @@ -1,6 +1,6 @@ # Kubernetes -GraphQL Protect is intended to run as sidecar to your main application. This allows it to scale with your application, and enjoys the benefit of loopback networking. +GraphQL Protect is intended to run as proxy to your main application. This allows it to scale with your application, and enjoys the benefit of loopback networking. ## Deployment resource diff --git a/go.mod b/go.mod index ba136e6..9df58c4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ldebruijn/graphql-protect -go 1.22.0 +go 1.23.0 require ( cloud.google.com/go/storage v1.43.0 diff --git a/internal/business/protect/protect.go b/internal/business/protect/protect.go index efd9463..23604fc 100644 --- a/internal/business/protect/protect.go +++ b/internal/business/protect/protect.go @@ -45,7 +45,7 @@ func NewGraphQLProtect(log *slog.Logger, cfg *config.Config, po *persistedoperat maxBatch, err := batch.NewMaxBatch(cfg.MaxBatch) accessLogging := accesslogging.NewAccessLogging(cfg.AccessLogging, log) if err != nil { - log.Warn("Error initializing maximum batch protection", err) + log.Warn("Error initializing maximum batch protection", "err", err) } enforcePostMethod := enforce_post.EnforcePostMethod(cfg.EnforcePost) diff --git a/internal/business/rules/aliases/aliases.go b/internal/business/rules/aliases/aliases.go index af8bd4e..18c2119 100644 --- a/internal/business/rules/aliases/aliases.go +++ b/internal/business/rules/aliases/aliases.go @@ -1,7 +1,6 @@ package aliases import ( - "fmt" "github.com/prometheus/client_golang/prometheus" "github.com/vektah/gqlparser/v2/ast" "github.com/vektah/gqlparser/v2/validator" @@ -50,9 +49,8 @@ func NewMaxAliasesRule(cfg Config) { if aliases > cfg.Max { if cfg.RejectOnFailure { - err := fmt.Sprintf("syntax error: Aliases limit of %d exceeded, found %d", cfg.Max, aliases) addError( - validator.Message(err), + validator.Message("syntax error: Aliases limit of %d exceeded, found %d", cfg.Max, aliases), validator.At(operation.Position), ) resultCounter.WithLabelValues("rejected").Inc() diff --git a/internal/business/rules/max_depth/max_depth.go b/internal/business/rules/max_depth/max_depth.go index bb6a11f..5258401 100644 --- a/internal/business/rules/max_depth/max_depth.go +++ b/internal/business/rules/max_depth/max_depth.go @@ -1,7 +1,6 @@ package max_depth // nolint:revive import ( - "fmt" "github.com/prometheus/client_golang/prometheus" "github.com/vektah/gqlparser/v2/ast" "github.com/vektah/gqlparser/v2/validator" @@ -34,9 +33,8 @@ func NewMaxDepthRule(cfg Config) { if maxDepth > cfg.Max { if cfg.RejectOnFailure { - err := fmt.Sprintf("syntax error: Depth limit of %d exceeded, found %d", cfg.Max, maxDepth) addError( - validator.Message(err), + validator.Message("syntax error: Depth limit of %d exceeded, found %d", cfg.Max, maxDepth), validator.At(operation.Position), ) resultCounter.WithLabelValues("rejected").Inc() diff --git a/makefile b/makefile index 4c7af9b..9e5808d 100644 --- a/makefile +++ b/makefile @@ -11,6 +11,7 @@ LDFLAGS += -s -w .PHONY: dev.setup dev.setup: go mod tidy + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1 .PHONY: build build: