Skip to content

Commit 2eea09c

Browse files
committed
Bump to using go 1.23
1 parent f14756d commit 2eea09c

File tree

8 files changed

+75
-42
lines changed

8 files changed

+75
-42
lines changed

.golangci.yml

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
run:
22
deadline: 2m
33

4-
skip-files:
5-
- "zz_generated\\..+\\.go$"
6-
74
output:
85
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
9-
format: colored-line-number
6+
formats:
7+
- format: colored-line-number
8+
print-linter-name: true
9+
show-stats: true
1010

1111
linters-settings:
1212
errcheck:
@@ -18,18 +18,16 @@ linters-settings:
1818
# default is false: such cases aren't reported by default.
1919
check-blank: true
2020

21-
# [deprecated] comma-separated list of pairs of the form pkg:regex
22-
# the regex is used to ignore names within pkg. (default "fmt:.*").
23-
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
24-
ignore: fmt:.*,io/ioutil:^Read.*
21+
# Updated to use exclude-functions instead of ignore
22+
exclude-functions: fmt:.*,io/ioutil:^Read.*
2523

2624
govet:
2725
# report about shadowed variables
2826
check-shadowing: false
2927

30-
golint:
31-
# minimal confidence for issues, default is 0.8
32-
min-confidence: 0.8
28+
revive:
29+
# confidence for issues, default is 0.8
30+
confidence: 0.8
3331

3432
gofmt:
3533
# simplify code: gofmt with `-s` option, true by default
@@ -38,16 +36,12 @@ linters-settings:
3836
goimports:
3937
# put imports beginning with prefix after 3rd-party packages;
4038
# it's a comma-separated list of prefixes
41-
local-prefixes: github.com/upbound/provider-gcp
39+
local-prefixes: github.com/upbound/provider-aws
4240

4341
gocyclo:
4442
# minimal code complexity to report, 30 by default (but we recommend 10-20)
4543
min-complexity: 10
4644

47-
maligned:
48-
# print struct with more effective memory layout or not, false by default
49-
suggest-new: true
50-
5145
dupl:
5246
# tokens count to trigger issue, 150 by default
5347
threshold: 100
@@ -62,13 +56,6 @@ linters-settings:
6256
# tab width in spaces. Default to 1.
6357
tab-width: 1
6458

65-
unused:
66-
# treat code as a program (not a library) and report unused exported identifiers; default is false.
67-
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
68-
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
69-
# with golangci-lint call it on a directory with the changed file.
70-
check-exported: false
71-
7259
unparam:
7360
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
7461
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
@@ -104,17 +91,18 @@ linters-settings:
10491

10592
linters:
10693
enable:
107-
- megacheck
10894
- govet
10995
- gocyclo
11096
- gocritic
111-
- interfacer
11297
- goconst
11398
- goimports
11499
- gofmt # We enable this as well as goimports for its simplify mode.
100+
- gosimple
115101
- prealloc
116-
- golint
102+
- revive
103+
- staticcheck
117104
- unconvert
105+
- unused
118106
- misspell
119107
- nakedret
120108

@@ -125,6 +113,10 @@ linters:
125113

126114

127115
issues:
116+
# Added the exclude-files configuration here to replace run.skip-files
117+
exclude-files:
118+
- "zz_generated\\..+\\.go$"
119+
128120
# Excluding configuration per-path and per-linter
129121
exclude-rules:
130122
# Exclude some linters from running on tests files.

Makefile

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ PLATFORMS ?= linux_amd64 linux_arm64
1010
-include build/makelib/output.mk
1111

1212
# Setup Go
13+
GO_REQUIRED_VERSION ?= 1.23
1314
NPROCS ?= 1
1415
# GOLANGCILINT_VERSION is inherited from build submodule by default.
1516
# Uncomment below if you need to override the version.
@@ -19,22 +20,45 @@ GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider
1920
GO_LDFLAGS += -X $(GO_PROJECT)/pkg/version.Version=$(VERSION)
2021
GO_SUBDIRS += cmd internal apis
2122
GO111MODULE = on
23+
2224
-include build/makelib/golang.mk
2325

2426
# ====================================================================================
2527
# Setup Kubernetes tools
2628

2729
# Uncomment below to override the versions from the build module
28-
# KIND_VERSION = v0.15.0
29-
UP_VERSION = v0.28.0
30-
# UP_CHANNEL = stable
31-
UPTEST_VERSION = v0.5.0
32-
CROSSPLANE_VERSION = 1.16.0
30+
#KIND_VERSION = v0.27.0
31+
UP_VERSION = v0.34.2
32+
#UP_CHANNEL = stable
33+
UPTEST_VERSION = v0.11.1
34+
UPTEST_LOCAL_VERSION = v0.13.0
35+
UPTEST_LOCAL_CHANNEL = stable
36+
KUSTOMIZE_VERSION = v5.3.0
37+
YQ_VERSION = v4.40.5
38+
CROSSPLANE_VERSION = 1.14.6
39+
CRDDIFF_VERSION = v0.12.1
40+
41+
export UP_VERSION := $(UP_VERSION)
42+
export UP_CHANNEL := $(UP_CHANNEL)
43+
3344
-include build/makelib/k8s_tools.mk
3445

46+
# uptest download and install
47+
UPTEST_LOCAL := $(TOOLS_HOST_DIR)/uptest-$(UPTEST_LOCAL_VERSION)
48+
49+
$(UPTEST_LOCAL):
50+
@$(INFO) installing uptest $(UPTEST_LOCAL)
51+
@mkdir -p $(TOOLS_HOST_DIR)
52+
@curl -fsSLo $(UPTEST_LOCAL) https://s3.us-west-2.amazonaws.com/crossplane.uptest.releases/$(UPTEST_LOCAL_CHANNEL)/$(UPTEST_LOCAL_VERSION)/bin/$(SAFEHOST_PLATFORM)/uptest || $(FAIL)
53+
@chmod +x $(UPTEST_LOCAL)
54+
@$(OK) installing uptest $(UPTEST_LOCAL)
55+
3556
# Setup Images
3657
REGISTRY_ORGS ?= xpkg.upbound.io/upbound
3758
IMAGES = provider-terraform
59+
BATCH_PLATFORMS ?= linux_amd64,linux_arm64
60+
export BATCH_PLATFORMS := $(BATCH_PLATFORMS)
61+
3862
-include build/makelib/imagelight.mk
3963

4064
# ====================================================================================
@@ -110,11 +134,19 @@ CROSSPLANE_NAMESPACE = upbound-system
110134

111135
# This target requires the following environment variables to be set:
112136
# - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test
113-
# - UPTEST_CLOUD_CREDENTIALS (optional), cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials)
137+
# - UPTEST_CLOUD_CREDENTIALS (optional), multiple sets of AWS IAM User credentials specified as key=value pairs.
138+
# The support keys are currently `DEFAULT` and `PEER`. So, an example for the value of this env. variable is:
139+
# DEFAULT='[default]
140+
# aws_access_key_id = REDACTED
141+
# aws_secret_access_key = REDACTED'
142+
# PEER='[default]
143+
# aws_access_key_id = REDACTED
144+
# aws_secret_access_key = REDACTED'
145+
# The associated `ProviderConfig`s will be named as `default` and `peer`.
114146
# - UPTEST_DATASOURCE_PATH (optional), see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource
115-
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
147+
uptest: $(UPTEST_LOCAL) $(KUBECTL) $(KUTTL)
116148
@$(INFO) running automated tests
117-
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh || $(FAIL)
149+
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST_LOCAL) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh --default-conditions="Test" || $(FAIL)
118150
@$(OK) running automated tests
119151

120152
local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)

apis/v1beta1/storeconfig_types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ type StoreConfigStatus struct {
3535
xpv1.ConditionedStatus `json:",inline"`
3636
}
3737

38+
// GetCondition of this StoreConfigStatus.
39+
func (s *StoreConfigStatus) GetCondition(ct xpv1.ConditionType) xpv1.Condition {
40+
return s.ConditionedStatus.GetCondition(ct)
41+
}
42+
43+
// SetConditions of this StoreConfigStatus.
44+
func (s *StoreConfigStatus) SetConditions(c ...xpv1.Condition) {
45+
s.ConditionedStatus.SetConditions(c...)
46+
}
47+
3848
// +kubebuilder:object:root=true
3949

4050
// A StoreConfig configures how GCP controller should store connection details.

cmd/provider/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ import (
2929
"github.com/crossplane/crossplane-runtime/pkg/statemetrics"
3030
zapuber "go.uber.org/zap"
3131
"go.uber.org/zap/zapcore"
32+
kingpin "gopkg.in/alecthomas/kingpin.v2"
3233

3334
"k8s.io/client-go/tools/leaderelection/resourcelock"
3435

35-
"gopkg.in/alecthomas/kingpin.v2"
3636
kerrors "k8s.io/apimachinery/pkg/api/errors"
3737
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3838
ctrl "sigs.k8s.io/controller-runtime"

go.mod

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

3-
go 1.22.12
3+
go 1.23.7
44

55
require (
66
github.com/MakeNowJust/heredoc v1.0.0

internal/controller/workspace/workspace.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828

2929
"github.com/crossplane/crossplane-runtime/pkg/logging"
3030
"github.com/crossplane/crossplane-runtime/pkg/statemetrics"
31+
getter "github.com/hashicorp/go-getter"
3132
"github.com/pkg/errors"
3233
"github.com/spf13/afero"
3334
corev1 "k8s.io/api/core/v1"
@@ -45,8 +46,6 @@ import (
4546
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
4647
"github.com/crossplane/crossplane-runtime/pkg/resource"
4748

48-
"github.com/hashicorp/go-getter"
49-
5049
"github.com/upbound/provider-terraform/apis/v1beta1"
5150
"github.com/upbound/provider-terraform/internal/controller/features"
5251
"github.com/upbound/provider-terraform/internal/terraform"

internal/controller/workspace/workspace_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ func TestObserve(t *testing.T) {
11071107
ResourceExists: true,
11081108
ResourceUpToDate: true,
11091109
ConnectionDetails: managed.ConnectionDetails{
1110-
"string": {},
1110+
"string": []byte{},
11111111
"object": []byte("null"), // Because we JSON decode the the value, which is any{}
11121112
},
11131113
},
@@ -1150,7 +1150,7 @@ func TestObserve(t *testing.T) {
11501150
ResourceExists: true,
11511151
ResourceUpToDate: true,
11521152
ConnectionDetails: managed.ConnectionDetails{
1153-
"string": {},
1153+
"string": []byte{},
11541154
"object": []byte("null"), // Because we JSON decode the the value, which is any{}
11551155
},
11561156
},
@@ -1374,7 +1374,7 @@ func TestCreate(t *testing.T) {
13741374
want: want{
13751375
c: managed.ExternalCreation{
13761376
ConnectionDetails: managed.ConnectionDetails{
1377-
"string": {},
1377+
"string": []byte{},
13781378
"object": []byte("null"), // Because we JSON decode the value, which is any{}
13791379
},
13801380
},

0 commit comments

Comments
 (0)