Skip to content

Commit 5db33cd

Browse files
committed
chore: upgrade to Go 1.22
1 parent dc553db commit 5db33cd

File tree

8 files changed

+28
-78
lines changed

8 files changed

+28
-78
lines changed

.github/workflows/docs.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ jobs:
2525
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
2626
restore-keys: |
2727
${{ runner.os }}-go-
28-
- uses: actions/setup-go@v5
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
2930
with:
30-
go-version: ${{ matrix.go }}
31+
go-version-file: go.mod
3132
- run: mkdir -p ~/.config/equinix
3233
- run: touch ~/.config/equinix/metal.yaml
3334
- name: Build docs

.github/workflows/e2e-test.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ jobs:
3737
runs-on: ubuntu-latest
3838
concurrency: 'e2e-test'
3939
steps:
40-
- name: Set up Go
41-
uses: actions/setup-go@v5
42-
with:
43-
go-version: '1.19'
4440
- name: Check out code into the Go module directory
4541
uses: actions/checkout@v4
4642
with:
4743
ref: ${{ github.event.pull_request.head.sha || github.ref }}
44+
- name: Set up Go
45+
uses: actions/setup-go@v5
46+
with:
47+
go-version-file: go.mod
4848
- name: Get dependencies
4949
run: go mod download
5050
- name: Run end-to-end tests

.github/workflows/golangci-lint.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@ jobs:
1616
name: lint
1717
runs-on: ubuntu-latest
1818
steps:
19+
- uses: actions/checkout@v4
1920
- uses: actions/setup-go@v5
2021
with:
21-
go-version: 1.19
22-
- uses: actions/checkout@v4
22+
go-version-file: go.mod
23+
- name: Determine golangci-lint version
24+
id: golangcilint
25+
run: |
26+
line=$(grep GOLANGCI_LINT_VERSION= Makefile)
27+
version=$(echo ${line} | cut -d = -f2)
28+
echo "version=$version" >> "$GITHUB_OUTPUT"
2329
- name: golangci-lint
2430
uses: golangci/golangci-lint-action@v3
2531
with:
2632
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
27-
version: v1.49
33+
version: ${{ steps.golangcilint.outputs.version }}
2834

2935
# Optional: working directory, useful for monorepos
3036
# working-directory: somedir
@@ -43,4 +49,4 @@ jobs:
4349
# skip-pkg-cache: true
4450

4551
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
46-
# skip-build-cache: true
52+
# skip-build-cache: true

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: Set up Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: 1.19
21+
go-version-file: go.mod
2222
-
2323
name: Run GoReleaser
2424
uses: goreleaser/goreleaser-action@v5

.github/workflows/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ jobs:
66
runs-on: ubuntu-latest
77
timeout-minutes: 10
88
steps:
9+
- name: Check out code into the Go module directory
10+
uses: actions/checkout@v4
911
- name: Set up Go
1012
uses: actions/setup-go@v5
1113
with:
12-
go-version: '1.19'
13-
- name: Check out code into the Go module directory
14-
uses: actions/checkout@v4
14+
go-version-file: go.mod
1515
- name: Get dependencies
1616
run: go mod download
1717
- name: Build

Makefile

+6-18
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ PLATFORMS?=darwin linux windows freebsd
2020
ARCHITECTURES?=amd64 arm64
2121
GOBIN?=$(shell go env GOPATH)/bin
2222
FORMATTER?=$(GOBIN)/goimports
23-
GO_INSTALL = ./hack/go_install.sh
24-
TOOLS_DIR := hack/tools
25-
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin)
2623

27-
28-
# Binaries.
29-
GOLANGCI_LINT_VER := v1.49
30-
GOLANGCI_LINT_BIN := golangci-lint
31-
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
24+
CRI=docker
25+
CRI_COMMAND_BASE=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} $(DOCKER_EXTRA_ARGS)
26+
GOLANGCI_LINT_VERSION=v1.56
27+
GOLANGCI_LINT_IMAGE=golangci/golangci-lint:${GOLANGCI_LINT_VERSION}
28+
GOLANGCI_LINT=${CRI_COMMAND_BASE} -v $(CURDIR):/app -w /app -e GOLANGCI_LINT_CACHE=/tmp/.cache -e GOCACHE=/tmp/.cache ${GOLANGCI_LINT_IMAGE} golangci-lint
3229

3330
# Setup linker flags option for build that interoperate with variable names in src code
3431
LDFLAGS?=-ldflags "-X $(PACKAGE_NAME)/cmd.Version=$(VERSION) -X $(PACKAGE_NAME)/cmd.Build=$(BUILD)"
@@ -42,7 +39,7 @@ fmt: $(FORMATTER)
4239
$(FORMATTER):
4340
go get golang.org/x/tools/cmd/goimports
4441

45-
lint: $(GOLANGCI_LINT) ## Lint codebase
42+
lint: ## Lint codebase
4643
$(GOLANGCI_LINT) run -v --fast=false
4744

4845
build:
@@ -69,12 +66,3 @@ generate-docs: clean-docs
6966

7067
test:
7168
go test -v ./... -timeout 1000s
72-
73-
74-
## --------------------------------------
75-
## Tooling Binaries
76-
## --------------------------------------
77-
78-
$(GOLANGCI_LINT): ## Build golangci-lint from tools folder.
79-
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)
80-
golangci-lint: $(LINTER)

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/equinix/metal-cli
22

3-
go 1.19
3+
go 1.22
44

55
require (
66
github.com/equinix/equinix-sdk-go v0.35.0

hack/go_install.sh

-45
This file was deleted.

0 commit comments

Comments
 (0)