From e5da099be4f7605710d43bd7b5cd366c0cee0374 Mon Sep 17 00:00:00 2001 From: Pulumi Bot <30351955+pulumi-bot@users.noreply.github.com> Date: Wed, 25 Feb 2026 12:40:02 -0800 Subject: [PATCH] Upgrade to golangci-lint v2 (#775) Upgrades golangci-lint from v1 to v2. Automated by Linear issue IT-144. Co-authored-by: CI --- .golangci.yml | 79 ++++++++++++++++++++---------------- examples/dotnet_test.go | 3 +- examples/go/main.go | 3 +- examples/go_test.go | 3 +- examples/java_test.go | 3 +- examples/nodejs_test.go | 5 ++- examples/python_test.go | 3 +- examples/yaml_test.go | 6 ++- mise.toml | 2 + provider/internal/context.go | 2 +- provider/internal/host.go | 10 ++--- 11 files changed, 69 insertions(+), 50 deletions(-) create mode 100644 mise.toml diff --git a/.golangci.yml b/.golangci.yml index 4235632..e46616d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,37 +1,46 @@ -# WARNING: This file is autogenerated - changes will be overwritten when regenerated by https://github.com/pulumi/ci-mgmt - +version: "2" linters: enable: - - errcheck - - gci - - goconst - - gofmt - - gosec - - govet - - ineffassign - - lll - - gosimple - - staticcheck - - misspell - - nakedret - - revive - - unconvert - - unused - enable-all: false -issues: - exclude-dirs: - - pkg/vendored - exclude-files: - - schema.go - - pulumiManifest.go -run: - timeout: 20m -linters-settings: - gci: - sections: - - standard # Standard section: captures all standard library packages. - - blank # Blank section: contains all blank imports. - - default # Default section: contains all imports that could not be matched to another section type. - - prefix(github.com/pulumi/) # Custom section: groups all imports with the github.com/pulumi/ prefix. - - prefix(github.com/pulumi/pulumi-docker-build) # Custom section: local imports - custom-order: true + - goconst + - gosec + - lll + - misspell + - nakedret + - revive + - unconvert + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - schema.go + - pulumiManifest.go + - pkg/vendored + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gci + - gofmt + settings: + gci: + sections: + - standard + - blank + - default + - prefix(github.com/pulumi/) + - prefix(github.com/pulumi/pulumi-docker-build) + custom-order: true + exclusions: + generated: lax + paths: + - schema.go + - pulumiManifest.go + - pkg/vendored + - third_party$ + - builtin$ + - examples$ diff --git a/examples/dotnet_test.go b/examples/dotnet_test.go index 130ba24..ce6dc41 100644 --- a/examples/dotnet_test.go +++ b/examples/dotnet_test.go @@ -10,8 +10,9 @@ import ( "path/filepath" "testing" - "github.com/pulumi/pulumi/pkg/v3/testing/integration" "github.com/stretchr/testify/require" + + "github.com/pulumi/pulumi/pkg/v3/testing/integration" ) func TestDotNetExample(t *testing.T) { diff --git a/examples/go/main.go b/examples/go/main.go index 54e4979..f40f170 100644 --- a/examples/go/main.go +++ b/examples/go/main.go @@ -1,9 +1,10 @@ package main import ( - "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config" + + "github.com/pulumi/pulumi-docker-build/sdk/go/dockerbuild" ) func main() { diff --git a/examples/go_test.go b/examples/go_test.go index 95588b5..def5a67 100644 --- a/examples/go_test.go +++ b/examples/go_test.go @@ -8,8 +8,9 @@ import ( "path" "testing" - "github.com/pulumi/pulumi/pkg/v3/testing/integration" "github.com/stretchr/testify/require" + + "github.com/pulumi/pulumi/pkg/v3/testing/integration" ) func TestGoExample(t *testing.T) { diff --git a/examples/java_test.go b/examples/java_test.go index 70ff785..a526211 100644 --- a/examples/java_test.go +++ b/examples/java_test.go @@ -8,8 +8,9 @@ import ( "path" "testing" - "github.com/pulumi/pulumi/pkg/v3/testing/integration" "github.com/stretchr/testify/require" + + "github.com/pulumi/pulumi/pkg/v3/testing/integration" ) func TestJavaExample(t *testing.T) { diff --git a/examples/nodejs_test.go b/examples/nodejs_test.go index 95d0e1e..c2f89dc 100644 --- a/examples/nodejs_test.go +++ b/examples/nodejs_test.go @@ -16,14 +16,15 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ecr" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/pulumi/providertest" "github.com/pulumi/providertest/optproviderupgrade" "github.com/pulumi/providertest/pulumitest" "github.com/pulumi/providertest/pulumitest/assertpreview" "github.com/pulumi/providertest/pulumitest/opttest" "github.com/pulumi/pulumi/pkg/v3/testing/integration" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNodeExample(t *testing.T) { diff --git a/examples/python_test.go b/examples/python_test.go index 0ff6310..c4b2432 100644 --- a/examples/python_test.go +++ b/examples/python_test.go @@ -8,8 +8,9 @@ import ( "path" "testing" - "github.com/pulumi/pulumi/pkg/v3/testing/integration" "github.com/stretchr/testify/require" + + "github.com/pulumi/pulumi/pkg/v3/testing/integration" ) func TestPythonExample(t *testing.T) { diff --git a/examples/yaml_test.go b/examples/yaml_test.go index 3b8cc5b..ffc928f 100644 --- a/examples/yaml_test.go +++ b/examples/yaml_test.go @@ -8,15 +8,17 @@ import ( "path" "testing" + "github.com/stretchr/testify/require" + "github.com/pulumi/providertest" "github.com/pulumi/providertest/providers" "github.com/pulumi/providertest/pulumitest" "github.com/pulumi/providertest/pulumitest/assertpreview" "github.com/pulumi/providertest/pulumitest/opttest" - "github.com/pulumi/pulumi-docker-build/provider" "github.com/pulumi/pulumi/pkg/v3/testing/integration" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" - "github.com/stretchr/testify/require" + + "github.com/pulumi/pulumi-docker-build/provider" ) func TestYAMLExample(t *testing.T) { diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..a20ffe4 --- /dev/null +++ b/mise.toml @@ -0,0 +1,2 @@ +[tools] +golangci-lint = "2.7.0" diff --git a/provider/internal/context.go b/provider/internal/context.go index fc00765..1435ab3 100644 --- a/provider/internal/context.go +++ b/provider/internal/context.go @@ -170,7 +170,7 @@ func hashFile( if fileMode.IsDir() { return nil } - if !(fileMode.IsRegular() || fileMode.Type() == os.ModeSymlink) { + if !fileMode.IsRegular() && fileMode.Type() != os.ModeSymlink { return nil } diff --git a/provider/internal/host.go b/provider/internal/host.go index 78a6b67..8ede0c0 100644 --- a/provider/internal/host.go +++ b/provider/internal/host.go @@ -98,13 +98,13 @@ func (h *host) builderFor(ctx context.Context, build Build) (*cachedBuilder, err if err != nil && build.ShouldExec() && strings.HasPrefix(opts.Builder, "cloud-") { //nolint:revive // Human-readable. err = errors.Join(err, - errors.New("Make sure you're logged in to Docker (`docker login`) if you're trying to use a cloud builder."), - errors.New("Make sure you have the correct buildx plugin installed (https://github.com/docker/buildx-desktop)."), + errors.New("Make sure you're logged in to Docker (`docker login`) if you're trying to use a cloud builder"), //nolint:lll,staticcheck + errors.New("Make sure you have the correct buildx plugin installed (https://github.com/docker/buildx-desktop)"), //nolint:lll,staticcheck ) } if err != nil && build.ShouldExec() { //nolint:revive // Human-readable. - err = errors.Join(err, errors.New( + err = errors.Join(err, errors.New( //nolint:staticcheck "Make sure your buildx plugin is executable (`docker buildx version`)"), ) } @@ -176,8 +176,8 @@ func (h *host) builderFor(ctx context.Context, build Build) (*cachedBuilder, err if err != nil && !build.ShouldExec() { if strings.Contains(err.Error(), "failed to find driver") { //nolint:revive // Human-readable. - err = errors.Join(err, errors.New( - "Use `exec: true` if you're trying to use Docker Build Cloud or other custom drivers.", + err = errors.Join(err, errors.New( //nolint:staticcheck + "Use `exec: true` if you're trying to use Docker Build Cloud or other custom drivers", )) } return nil, fmt.Errorf("loading nodes: %w", err)