Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates Go to 1.21, golangci-lint to 1.55.2 #7262

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .build-tools/cmd/check-lint-version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestParseWorkflow(t *testing.T) {
func TestGetCurrentVersion(t *testing.T) {
t.Run("get current version from system", func(t *testing.T) {
currentVersion, err := getCurrentVersion()
assert.Equal(t, "v1.51.2", currentVersion)
assert.Equal(t, "v1.55.2", currentVersion)
assert.NoError(t, err)
})

Expand Down
2 changes: 1 addition & 1 deletion .build-tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module build-tools

go 1.20
go 1.21

require (
github.com/google/go-containerregistry v0.11.1-0.20220802162123-c1f9836a4fa9
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dapr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
target_os: ["linux"]
target_arch: ["amd64"]
env:
GOLANGCILINT_VER: "v1.51.2"
GOLANGCILINT_VER: "v1.55.2"
PROTOC_VERSION: "21.12"
GOOS: "${{ matrix.target_os }}"
GOARCH: "${{ matrix.target_arch }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-tooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- "macos-latest"
runs-on: ${{ matrix.os }}
env:
GOLANGCILINT_VER: "v1.51.2" # Make sure to bump /.build-tools/check-lint-version/main_test.go
GOLANGCILINT_VER: "v1.55.2" # Make sure to bump /.build-tools/check-lint-version/main_test.go

steps:
- name: Checkout
Expand All @@ -46,4 +46,4 @@ jobs:

- name: Test
working-directory: ./.build-tools
run: go test ./...
run: go test ./...
82 changes: 54 additions & 28 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,34 +121,58 @@ linters-settings:
# minimal occurrences count to trigger, 3 by default
min-occurrences: 5
depguard:
list-type: denylist
include-go-root: false
packages-with-error-message:
- "github.com/Sirupsen/logrus": "must use github.com/dapr/kit/logger"
- "github.com/agrea/ptr": "must use github.com/dapr/kit/ptr"
- "go.uber.org/atomic": "must use sync/atomic"
- "golang.org/x/net/context": "must use context"
- "github.com/pkg/errors": "must use standard library (errors package and/or fmt.Errorf)"
- "github.com/go-chi/chi$": "must use github.com/go-chi/chi/v5"
- "github.com/cenkalti/backoff$": "must use github.com/cenkalti/backoff/v4"
- "github.com/cenkalti/backoff/v2": "must use github.com/cenkalti/backoff/v4"
- "github.com/cenkalti/backoff/v3": "must use github.com/cenkalti/backoff/v4"
- "github.com/benbjohnson/clock": "must use k8s.io/utils/clock"
- "github.com/ghodss/yaml": "must use sigs.k8s.io/yaml"
- "gopkg.in/yaml.v2": "must use gopkg.in/yaml.v3"
- "github.com/golang-jwt/jwt": "must use github.com/lestrrat-go/jwx/v2"
- "github.com/golang-jwt/jwt/v2": "must use github.com/lestrrat-go/jwx/v2"
- "github.com/golang-jwt/jwt/v3": "must use github.com/lestrrat-go/jwx/v2"
- "github.com/golang-jwt/jwt/v4": "must use github.com/lestrrat-go/jwx/v2"
# Commonly auto-completed by gopls
- "github.com/gogo/status": "must use google.golang.org/grpc/status"
- "github.com/gogo/protobuf": "must use google.golang.org/protobuf"
- "github.com/lestrrat-go/jwx/jwa": "must use github.com/lestrrat-go/jwx/v2"
- "github.com/lestrrat-go/jwx/jwt": "must use github.com/lestrrat-go/jwx/v2"
- "github.com/labstack/gommon/log": "must use github.com/dapr/kit/logger"
- "github.com/gobuffalo/logger": "must use github.com/dapr/kit/logger"
- "k8s.io/utils/pointer": "must use github.com/dapr/kit/ptr"
- "k8s.io/utils/ptr": "must use github.com/dapr/kit/ptr"
rules:
master:
deny:
- pkg: "github.com/Sirupsen/logrus"
desc: "must use github.com/dapr/kit/logger"
- pkg: "github.com/agrea/ptr"
desc: "must use github.com/dapr/kit/ptr"
- pkg: "go.uber.org/atomic"
desc: "must use sync/atomic"
- pkg: "golang.org/x/net/context"
desc: "must use context"
- pkg: "github.com/pkg/errors"
desc: "must use standard library (errors package and/or fmt.Errorf)"
- pkg: "github.com/go-chi/chi$"
desc: "must use github.com/go-chi/chi/v5"
- pkg: "github.com/cenkalti/backoff$"
desc: "must use github.com/cenkalti/backoff/v4"
- pkg: "github.com/cenkalti/backoff/v2"
desc: "must use github.com/cenkalti/backoff/v4"
- pkg: "github.com/cenkalti/backoff/v3"
desc: "must use github.com/cenkalti/backoff/v4"
- pkg: "github.com/benbjohnson/clock"
desc: "must use k8s.io/utils/clock"
- pkg: "github.com/ghodss/yaml"
desc: "must use sigs.k8s.io/yaml"
- pkg: "gopkg.in/yaml.v2"
desc: "must use gopkg.in/yaml.v3"
- pkg: "github.com/golang-jwt/jwt"
desc: "must use github.com/lestrrat-go/jwx/v2"
- pkg: "github.com/golang-jwt/jwt/v2"
desc: "must use github.com/lestrrat-go/jwx/v2"
- pkg: "github.com/golang-jwt/jwt/v3"
desc: "must use github.com/lestrrat-go/jwx/v2"
- pkg: "github.com/golang-jwt/jwt/v4"
desc: "must use github.com/lestrrat-go/jwx/v2"
# pkg: Commonly auto-completed by gopls
- pkg: "github.com/gogo/status"
desc: "must use google.golang.org/grpc/status"
- pkg: "github.com/gogo/protobuf"
desc: "must use google.golang.org/protobuf"
- pkg: "github.com/lestrrat-go/jwx/jwa"
desc: "must use github.com/lestrrat-go/jwx/v2"
- pkg: "github.com/lestrrat-go/jwx/jwt"
desc: "must use github.com/lestrrat-go/jwx/v2"
- pkg: "github.com/labstack/gommon/log"
desc: "must use github.com/dapr/kit/logger"
- pkg: "github.com/gobuffalo/logger"
desc: "must use github.com/dapr/kit/logger"
- pkg: "k8s.io/utils/pointer"
desc: "must use github.com/dapr/kit/ptr"
- pkg: "k8s.io/utils/ptr"
desc: "must use github.com/dapr/kit/ptr"
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
Expand Down Expand Up @@ -305,3 +329,5 @@ linters:
- structcheck
- varcheck
- deadcode
- inamedparam
- tagalign
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ MODFILES := $(shell find . -name go.mod)
define modtidy-target
.PHONY: modtidy-$(1)
modtidy-$(1):
cd $(shell dirname $(1)); CGO_ENABLED=$(CGO) go mod tidy -compat=1.20; cd -
cd $(shell dirname $(1)); CGO_ENABLED=$(CGO) go mod tidy -compat=1.21; cd -
endef

# Generate modtidy target action for each go.mod file
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile-debug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# current directory must be ./dist

FROM golang:1.20
FROM golang:1.21

ARG PKG_FILES
RUN go install github.com/go-delve/delve/cmd/dlv@latest
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Based on https://github.com/microsoft/vscode-dev-containers/tree/v0.224.3/containers/go/.devcontainer/base.Dockerfile

# [Choice] Go version: 1, 1.20, etc
ARG GOVERSION=1.20
# [Choice] Go version: 1, 1.21, etc
ARG GOVERSION=1.21
FROM golang:${GOVERSION}-bullseye

# [Option] Install zsh
Expand All @@ -15,7 +15,7 @@ ARG DAPR_CLI_VERSION="latest"
ARG PROTOC_VERSION="21.12"
ARG PROTOC_GEN_GO_VERSION="1.28.1"
ARG PROTOC_GEN_GO_GRPC_VERSION="1.2.0"
ARG GOLANGCI_LINT_VERSION="1.51.2"
ARG GOLANGCI_LINT_VERSION="1.55.2"

# This Dockerfile adds a non-root 'dapr' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This includes dockerfiles to build Dapr release and debug images and development

The Dev Container can be rebuilt with custom options. Relevant args (and their default values) include:

* `GOVERSION` (default: `1.20`)
* `GOVERSION` (default: `1.21`)
* `INSTALL_ZSH` (default: `true`)
* `KUBECTL_VERSION` (default: `latest`)
* `HELM_VERSION` (default: `latest`)
Expand Down
2 changes: 1 addition & 1 deletion docker/custom-scripts/install-dapr-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DAPR_CLI_VERSION=${4:-""}
PROTOC_VERSION=${5:-"21.12"}
PROTOC_GEN_GO_VERSION=${6:-"1.28.1"}
PROTOC_GEN_GO_GRPC_VERSION=${7:-"1.2.0"}
GOLANGCI_LINT_VERSION=${8:-"1.51.2"}
GOLANGCI_LINT_VERSION=${8:-"1.55.2"}

set -e

Expand Down
2 changes: 1 addition & 1 deletion docs/development/developing-dapr.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ This command will:
- format, test and lint all the code
- check if you forgot to `git commit` something

Note: To run linter locally, please use golangci-lint version v1.51.2, otherwise you might encounter errors. You can download version v1.51.2 [here](https://github.com/golangci/golangci-lint/releases/tag/v1.51.2).
Note: To run linter locally, please use golangci-lint version v1.51.2, otherwise you might encounter errors. You can download version v1.55.2 [here](https://github.com/golangci/golangci-lint/releases/tag/v1.55.2).

## Debug Dapr

Expand Down
4 changes: 2 additions & 2 deletions docs/development/setup-dapr-development-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ This document helps you get started developing Dapr. If you find any problems wh

## Go (Golang)

1. Download and install [Go 1.20 or later](https://golang.org/doc/install#tarball).
1. Download and install [Go 1.21 or later](https://golang.org/doc/install#tarball).

2. Install [Delve](https://github.com/go-delve/delve/tree/master/Documentation/installation) for Go debugging, if desired.

3. Install [golangci-lint](https://golangci-lint.run/usage/install) version 1.51.2.
3. Install [golangci-lint](https://golangci-lint.run/usage/install) version 1.55.2.

## Setup a Kubernetes development environment

Expand Down
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/dapr/dapr

go 1.20
go 1.21

toolchain go1.21.4

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.2
Expand All @@ -9,7 +11,7 @@ require (
github.com/argoproj/argo-rollouts v1.4.1
github.com/cenkalti/backoff/v4 v4.2.1
github.com/cloudevents/sdk-go/v2 v2.14.0
github.com/dapr/components-contrib v1.12.1-0.20231102232056-f4e73b0e6511
github.com/dapr/components-contrib v1.12.1-0.20231129042434-36a055ebd8d7
github.com/dapr/kit v0.12.2-0.20231031211530-0e1fd37fc4b3
github.com/evanphx/json-patch/v5 v5.7.0
github.com/go-chi/chi/v5 v5.0.10
Expand Down Expand Up @@ -94,13 +96,13 @@ require (
github.com/AthenZ/athenz v1.10.39 // indirect
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai v0.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig v0.6.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v0.3.6 // indirect
github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.0.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs v1.0.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.1.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs v1.0.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.5.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid/v2 v2.1.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhub v1.1.1 // indirect
Expand Down