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 9abec73
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 69 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.19
- uses: actions/checkout@v4
- 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 +46,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
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 9abec73

Please sign in to comment.