Skip to content

Commit

Permalink
chore: upgrade to Go 1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed May 13, 2024
1 parent dc553db commit dc51b6b
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 78 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-go@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
go-version-file: go.mod
- run: mkdir -p ~/.config/equinix
- run: touch ~/.config/equinix/metal.yaml
- name: Build docs
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ jobs:
runs-on: ubuntu-latest
concurrency: 'e2e-test'
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.19'
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Get dependencies
run: go mod download
- name: Run end-to-end tests
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.19
- uses: actions/checkout@v4
go-version-file: go.mod
- name: Determine golangci-lint version
id: golangcilint
run: |
line=$(grep GOLANGCI_LINT_VERSION= Makefile)
version=$(echo ${line} | cut -d = -f2)
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.49
version: ${{ steps.golangcilint.outputs.version }}

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand All @@ -43,4 +49,4 @@ jobs:
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
# skip-build-cache: true
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
go-version-file: go.mod
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.19'
- name: Check out code into the Go module directory
uses: actions/checkout@v4
go-version-file: go.mod
- name: Get dependencies
run: go mod download
- name: Build
Expand Down
24 changes: 6 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ PLATFORMS?=darwin linux windows freebsd
ARCHITECTURES?=amd64 arm64
GOBIN?=$(shell go env GOPATH)/bin
FORMATTER?=$(GOBIN)/goimports
GO_INSTALL = ./hack/go_install.sh
TOOLS_DIR := hack/tools
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin)


# Binaries.
GOLANGCI_LINT_VER := v1.49
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
CRI=docker
CRI_COMMAND_BASE=${CRI} run --rm -u ${CURRENT_UID}:${CURRENT_GID} $(DOCKER_EXTRA_ARGS)
GOLANGCI_LINT_VERSION=v1.56
GOLANGCI_LINT_IMAGE=golangci/golangci-lint:${GOLANGCI_LINT_VERSION}
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

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

lint: $(GOLANGCI_LINT) ## Lint codebase
lint: ## Lint codebase
$(GOLANGCI_LINT) run -v --fast=false

build:
Expand All @@ -69,12 +66,3 @@ generate-docs: clean-docs

test:
go test -v ./... -timeout 1000s


## --------------------------------------
## Tooling Binaries
## --------------------------------------

$(GOLANGCI_LINT): ## Build golangci-lint from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)
golangci-lint: $(LINTER)
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/equinix/metal-cli

go 1.19
go 1.22

require (
github.com/equinix/equinix-sdk-go v0.35.0
Expand Down
45 changes: 0 additions & 45 deletions hack/go_install.sh

This file was deleted.

0 comments on commit dc51b6b

Please sign in to comment.