Skip to content

Commit 145f476

Browse files
authored
Bump go version from 1.17 to 1.18 (#251)
* *: Bump go version from 1.17 to 1.18 Signed-off-by: timflannagan <[email protected]> * Makefile: Install tool dependency using 'go install' Signed-off-by: timflannagan <[email protected]>
1 parent decf748 commit 145f476

File tree

5 files changed

+70
-49
lines changed

5 files changed

+70
-49
lines changed

.github/workflows/go.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Go
1616
uses: actions/setup-go@v2
1717
with:
18-
go-version: 1.17
18+
go-version: 1.18
1919
id: go
2020
- name: Check out code into the Go module directory
2121
uses: actions/checkout@v2
@@ -39,7 +39,7 @@ jobs:
3939
- name: Set up Go
4040
uses: actions/setup-go@v2
4141
with:
42-
go-version: 1.17
42+
go-version: 1.18
4343
id: go
4444
- name: Print out Go env
4545
run: go env

.github/workflows/verify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v2
1515
- uses: actions/setup-go@v2
1616
with:
17-
go-version: '~1.17'
17+
go-version: '~1.18'
1818
- name: Run the verify target
1919
run: |
2020
export GOPATH=$(go env GOPATH)

Makefile

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,30 @@ test-unit: ## Run the unit tests
8686
verify: manifests generate format
8787
git diff --exit-code
8888

89-
###
90-
# Utilities.
91-
###
89+
################
90+
# Hack / Tools #
91+
################
92+
93+
GO_INSTALL_OPTS ?= "-mod=mod"
94+
95+
## Location to install dependencies to
96+
LOCALBIN ?= $(shell pwd)/bin
97+
$(LOCALBIN):
98+
mkdir -p $(LOCALBIN)
99+
100+
## Tool Binaries
101+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
102+
YQ ?= $(LOCALBIN)/yq
103+
104+
## Tool Versions
105+
CONTROLLER_TOOLS_VERSION ?= v0.8.0
106+
107+
.PHONY: controller-gen
108+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
109+
$(CONTROLLER_GEN): $(LOCALBIN)
110+
GOBIN=$(LOCALBIN) go install $(GO_INSTALL_OPTS) sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
92111

93-
# go-get-tool will 'go get' any package $2 and install it to $1.
94-
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
95-
define go-get-tool
96-
@[ -f $(1) ] || { \
97-
set -e ;\
98-
TMP_DIR=$$(mktemp -d) ;\
99-
cd $$TMP_DIR ;\
100-
go mod init tmp ;\
101-
echo "Downloading $(2)" ;\
102-
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
103-
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
104-
rm -rf $$TMP_DIR ;\
105-
}
106-
endef
107-
108-
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
109-
controller-gen: ## Download controller-gen locally if necessary.
110-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
111-
112-
YQ = $(shell pwd)/bin/yq
113-
yq:
114-
$(call go-get-tool,$(YQ),github.com/mikefarah/yq/v3)
112+
.PHONY: yq
113+
yq: $(YQ) ## Download yq locally if necessary.
114+
$(YQ): $(LOCALBIN)
115+
GOBIN=$(LOCALBIN) go install $(GO_INSTALL_OPTS) github.com/mikefarah/yq/v3@latest

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/operator-framework/api
22

3-
go 1.17
3+
go 1.18
44

55
require (
66
github.com/blang/semver v3.5.1+incompatible
@@ -47,6 +47,7 @@ require (
4747
github.com/kisielk/errcheck v1.5.0 // indirect
4848
github.com/mailru/easyjson v0.7.6 // indirect
4949
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
50+
github.com/mikefarah/yq/v3 v3.0.0-20201202084205-8846255d1c37 // indirect
5051
github.com/mitchellh/mapstructure v1.4.1 // indirect
5152
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5253
github.com/modern-go/reflect2 v1.0.2 // indirect

0 commit comments

Comments
 (0)