Skip to content

Commit 2347bc5

Browse files
authored
chore: Updates Go to 1.24.1 and linter (#3160)
* update Go * update linter * fix linter issues
1 parent 53ae5d6 commit 2347bc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+133
-179
lines changed

.github/workflows/code-health.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: golangci-lint
5050
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837
5151
with:
52-
version: v1.62.2 # Also update GOLANGCI_VERSION variable in GNUmakefile when updating this version
52+
version: v1.64.7 # Also update GOLANGCI_VERSION variable in GNUmakefile when updating this version
5353
- name: actionlint
5454
run: |
5555
make tools

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,11 @@ linters:
9797
- exhaustive
9898
- makezero
9999
- noctx
100-
- tenv
101100
- testpackage
101+
- usetesting
102102

103103
# don't enable:
104+
# - tenv # The linter 'tenv' is deprecated (since v1.64.0) due to: Duplicate feature another linter. Replaced by usetesting.
104105
# - deadcode
105106
# - varcheck
106107
# - structcheck

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ GITTAG=$(shell git describe --always --tags)
1717
VERSION=$(GITTAG:v%=%)
1818
LINKER_FLAGS=-s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion=${VERSION}'
1919

20-
GOLANGCI_VERSION=v1.62.2 # Also update golangci-lint GH action in code-health.yml when updating this version
20+
GOLANGCI_VERSION=v1.64.7 # Also update golangci-lint GH action in code-health.yml when updating this version
2121

2222
export PATH := $(shell go env GOPATH)/bin:$(PATH)
2323
export SHELL := env PATH=$(PATH) /bin/bash

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/mongodb/terraform-provider-mongodbatlas
22

3-
go 1.23.6
3+
go 1.24.1
44

55
require (
66
github.com/andygrunwald/go-jira/v2 v2.0.0-20240116150243-50d59fe116d6

internal/common/conversion/schema_generation_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package conversion_test
22

33
import (
4-
"context"
54
"testing"
65

76
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
@@ -104,7 +103,7 @@ func TestDataSourceSchemaFromResource(t *testing.T) {
104103
},
105104
},
106105
},
107-
"timeouts": timeouts.Attributes(context.Background(), timeouts.Opts{
106+
"timeouts": timeouts.Attributes(t.Context(), timeouts.Opts{
108107
Create: true,
109108
Update: true,
110109
Delete: true,

internal/common/conversion/tags_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package conversion_test
22

33
import (
4-
"context"
54
"testing"
65

76
"github.com/hashicorp/terraform-plugin-framework/attr"
@@ -26,7 +25,7 @@ func TestNewResourceTags(t *testing.T) {
2625
}
2726
for name, tc := range testCases {
2827
t.Run(name, func(t *testing.T) {
29-
assert.Equal(t, tc.expected, conversion.NewResourceTags(context.Background(), tc.plan))
28+
assert.Equal(t, tc.expected, conversion.NewResourceTags(t.Context(), tc.plan))
3029
})
3130
}
3231
}

internal/common/validate/aws_kms_config_validator_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package validate_test
22

33
import (
4-
"context"
54
"testing"
65

76
"github.com/hashicorp/terraform-plugin-framework/attr"
@@ -96,7 +95,7 @@ func TestValidAwsKmsConfig(t *testing.T) {
9695

9796
t.Run(tt.name, func(t *testing.T) {
9897
t.Parallel()
99-
AwsKmsConfigValidator.ValidateObject(context.Background(), validatorRequest, &validatorResponse)
98+
AwsKmsConfigValidator.ValidateObject(t.Context(), validatorRequest, &validatorResponse)
10099

101100
if validatorResponse.Diagnostics.HasError() && !wantErr {
102101
t.Errorf("error = %v, wantErr %v", validatorResponse.Diagnostics.Errors(), wantErr)

internal/common/validate/cidr_validator_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package validate_test
22

33
import (
4-
"context"
54
"testing"
65

76
"github.com/hashicorp/terraform-plugin-framework/diag"
@@ -52,7 +51,7 @@ func TestValidCIDR(t *testing.T) {
5251

5352
t.Run(tt.name, func(t *testing.T) {
5453
t.Parallel()
55-
cidrValidator.ValidateString(context.Background(), validatorRequest, &validatorResponse)
54+
cidrValidator.ValidateString(t.Context(), validatorRequest, &validatorResponse)
5655

5756
if validatorResponse.Diagnostics.HasError() && !wantErr {
5857
t.Errorf("URL() error = %v, wantErr %v", validatorResponse.Diagnostics.Errors(), wantErr)

internal/common/validate/duration_validator_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package validate_test
22

33
import (
4-
"context"
54
"testing"
65

76
"github.com/hashicorp/terraform-plugin-framework/diag"
@@ -79,7 +78,7 @@ func TestValidDurationBetween(t *testing.T) {
7978

8079
t.Run(tt.name, func(t *testing.T) {
8180
t.Parallel()
82-
cidrValidator.ValidateString(context.Background(), validatorRequest, &validatorResponse)
81+
cidrValidator.ValidateString(t.Context(), validatorRequest, &validatorResponse)
8382

8483
if validatorResponse.Diagnostics.HasError() && !wantErr {
8584
t.Errorf("URL() error = %v, wantErr %v", validatorResponse.Diagnostics.Errors(), wantErr)

internal/common/validate/ip_validator_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package validate_test
22

33
import (
4-
"context"
54
"testing"
65

76
"github.com/hashicorp/terraform-plugin-framework/diag"
@@ -57,7 +56,7 @@ func TestValidIP(t *testing.T) {
5756

5857
t.Run(tt.name, func(t *testing.T) {
5958
t.Parallel()
60-
cidrValidator.ValidateString(context.Background(), validatorRequest, &validatorResponse)
59+
cidrValidator.ValidateString(t.Context(), validatorRequest, &validatorResponse)
6160

6261
if validatorResponse.Diagnostics.HasError() && !wantErr {
6362
t.Errorf("URL() error = %v, wantErr %v", validatorResponse.Diagnostics.Errors(), wantErr)

0 commit comments

Comments
 (0)