Repository: honeycombio/terraform-provider-honeycombio
Pull request #542 (2024-09-11 19:47:41)

chore: bump Go to 1.22
This project follow's HashiCorp's policy on targeting "one version behind current", so with Go 1.23.1 out we'll upgrade to 1.22 ✨ 


Patch:
diff --git a/.go-version b/.go-version
index 26d7b6e..87b26e8 100644
--- a/.go-version
+++ b/.go-version
@@ -1,1 +1,1 @@
-1.21.12
+1.22.7
diff --git a/.golangci.yml b/.golangci.yml
index 18adb06..1576c80 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -20,7 +20,7 @@ linters:
     enable:
         - durationcheck
         - errcheck
-        - exportloopref
+        - copyloopvar
         - forcetypeassert
         - goimports
         - gosimple
diff --git a/go.mod b/go.mod
index ae90a51..4a6769d 100644
--- a/go.mod
+++ b/go.mod
@@ -1,8 +1,8 @@
 module github.com/honeycombio/terraform-provider-honeycombio
 
-go 1.21
+go 1.22
 
-toolchain go1.21.7
+toolchain go1.22.7
 
 require (
 	github.com/dunglas/httpsfv v1.0.2


Test patch:
diff --git a/client/v2/api_keys_test.go b/client/v2/api_keys_test.go
index 04f4b47..76843e9 100644
--- a/client/v2/api_keys_test.go
+++ b/client/v2/api_keys_test.go
@@ -83,7 +83,7 @@ func TestClient_APIKeys_Pagination(t *testing.T) {
 	// create a bunch of keys
 	numKeys := int(math.Floor(1.5 * float64(defaultPageSize)))
 	testKeys := make([]*APIKey, numKeys)
-	for i := 0; i < numKeys; i++ {
+	for i := range numKeys {
 		k, err := c.APIKeys.Create(ctx, &APIKey{
 			Name:    helper.ToPtr(fmt.Sprintf("test.%d", i)),
 			KeyType: "ingest",
diff --git a/client/v2/environments_test.go b/client/v2/environments_test.go
index 89d4f32..3e8dea4 100644
--- a/client/v2/environments_test.go
+++ b/client/v2/environments_test.go
@@ -89,7 +89,7 @@ func TestClient_Environments_Pagination(t *testing.T) {
 	// create a bunch of environments
 	numEnvs := int(math.Floor(1.5 * float64(defaultPageSize)))
 	testEnvs := make([]*Environment, numEnvs)
-	for i := 0; i < numEnvs; i++ {
+	for i := range numEnvs {
 		e, err := c.Environments.Create(ctx, &Environment{
 			Name: test.RandomStringWithPrefix("test.", 20),
 		})
diff --git a/internal/helper/validation/divisible_by_test.go b/internal/helper/validation/divisible_by_test.go
index b646b64..27752c4 100644
--- a/internal/helper/validation/divisible_by_test.go
+++ b/internal/helper/validation/divisible_by_test.go
@@ -44,7 +44,6 @@ func Test_BetweenValidator(t *testing.T) {
 	}
 
 	for name, test := range tests {
-		name, test := name, test
 		t.Run(name, func(t *testing.T) {
 			t.Parallel()
 			request := validator.Int64Request{
diff --git a/internal/helper/validation/precision_at_most_test.go b/internal/helper/validation/precision_at_most_test.go
index 60e7fb9..bb0d969 100644
--- a/internal/helper/validation/precision_at_most_test.go
+++ b/internal/helper/validation/precision_at_most_test.go
@@ -54,7 +54,6 @@ func TestValidation_PrecisionAtMost(t *testing.T) {
 	}
 
 	for name, test := range tests {
-		name, test := name, test
 		t.Run(name, func(t *testing.T) {
 			t.Parallel()
 			request := validator.Float64Request{
diff --git a/internal/helper/validation/query_spec_test.go b/internal/helper/validation/query_spec_test.go
index 5091682..e3f665b 100644
--- a/internal/helper/validation/query_spec_test.go
+++ b/internal/helper/validation/query_spec_test.go
@@ -39,7 +39,6 @@ func Test_QuerySpecValidator(t *testing.T) {
 	}
 
 	for name, test := range tests {
-		name, test := name, test
 		t.Run(name, func(t *testing.T) {
 			request := validator.StringRequest{
 				Path:           path.Root("test"),
diff --git a/internal/helper/validation/valid_regex_test.go b/internal/helper/validation/valid_regex_test.go
index 39bf36e..b71279d 100644
--- a/internal/helper/validation/valid_regex_test.go
+++ b/internal/helper/validation/valid_regex_test.go
@@ -35,7 +35,6 @@ func Test_IsValidRegexValidator(t *testing.T) {
 	}
 
 	for name, test := range tests {
-		name, test := name, test
 		t.Run(name, func(t *testing.T) {
 			t.Parallel()
 			request := validator.StringRequest{
diff --git a/internal/provider/datasets_data_source_test.go b/internal/provider/datasets_data_source_test.go
index fd60b0e..ed7d901 100644
--- a/internal/provider/datasets_data_source_test.go
+++ b/internal/provider/datasets_data_source_test.go
@@ -20,7 +20,7 @@ func TestAcc_DatasetsDatasource(t *testing.T) {
 
 	// create a bunch of datasets
 	testDatasets := make([]*client.Dataset, numDatasets)
-	for i := 0; i < numDatasets; i++ {
+	for i := range numDatasets {
 		d, err := c.Datasets.Create(ctx, &client.Dataset{
 			Name:        test.RandomStringWithPrefix("test.ds.", 20),
 			Description: test.RandomString(70),
diff --git a/internal/provider/environments_data_source_test.go b/internal/provider/environments_data_source_test.go
index 85b1754..223d88e 100644
--- a/internal/provider/environments_data_source_test.go
+++ b/internal/provider/environments_data_source_test.go
@@ -17,7 +17,7 @@ func TestAcc_EnvironmentsDatasource(t *testing.T) {
 
 	// create a bunch of environments
 	testEnvs := make([]*v2client.Environment, numEnvs)
-	for i := 0; i < numEnvs; i++ {
+	for i := range numEnvs {
 		e := testAccEnvironment(ctx, t, c)
 		testEnvs[i] = e
 	}