diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb53446..8504050 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,12 @@ jobs: golangci: name: Golang lint runs-on: ubuntu-latest + strategy: + matrix: + go-version: [1.18.x] steps: - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.40.1 + version: v1.45.2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c29af4..57443d4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - run: git fetch --force --tags - uses: actions/setup-go@v2 with: - go-version: 1.16 + go-version: 1.18 - id: generate_token uses: tibdex/github-app-token@v1 with: diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..f287e67 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,11 @@ +run: + go: 1.18 + +linters: + # The following are disabled until they support Go 1.18. See: + # https://github.com/golangci/golangci-lint/issues/2649 + disable: + - gosimple + - staticcheck + - structcheck + - unused diff --git a/Makefile b/Makefile index 8e6f930..2706df1 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,19 @@ BUILD_DIR := $(PWD)/.build SHELL := /bin/bash UNAME := $(shell uname) +ARCH := $(shell uname -m) GO_SOURCES := $(shell find `echo *` -name '*.go') -ifeq ($(findstring Darwin,$(UNAME)),Darwin) +GOLANG_VERSION := 1.18 +GOLANGCI_LINT_VERSION := 1.45.2 + +ifeq ($(findstring MINGW64_NT,$(UNAME)),MINGW64_NT) + OS := windows +else ifeq ($(findstring Darwin,$(UNAME)),Darwin) OS := darwin +else ifeq ($(findstring Linux,$(UNAME)),Linux) + OS := linux else $(error unsupported OS $(UNAME)) endif @@ -31,14 +39,14 @@ ifeq ($(OS),darwin) $(BUILD_DIR)/go/bin/go: @echo installing go... @mkdir -p $(BUILD_DIR)/bin - @cd $(BUILD_DIR) && curl -Ls https://golang.org/dl/go1.17.6.darwin-amd64.tar.gz | tar xz + @cd $(BUILD_DIR) && curl -Ls https://golang.org/dl/go$(GOLANG_VERSION).$(OS)-$(ARCH).tar.gz | tar xz endif $(BUILD_DIR)/bin/golangci-lint: $(BUILD_DIR)/bin/activate @echo 'install golangci-lint...' @source $(BUILD_DIR)/bin/activate && \ cd $(BUILD_DIR) && \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.40.1 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v$(GOLANGCI_LINT_VERSION) install-runtime: \ $(BUILD_DIR)/bin/golangci-lint \ @@ -59,7 +67,6 @@ $(BUILD_DIR)/bin/plz: $(BUILD_DIR)/bin/activate $(GO_SOURCES) go build -o $(BUILD_DIR)/bin/plz ./cmd/plz lint: $(BUILD_DIR)/bin/activate $(BUILD_DIR)/bin/golangci-lint - @source $(BUILD_DIR)/bin/activate && \ - golangci-lint run $(GO_SOURCES) + @source $(BUILD_DIR)/bin/activate && golangci-lint run .PHONY: lint diff --git a/go.mod b/go.mod index 3037f1f..fa2ed5d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/bitcomplete/plz-cli/client -go 1.17 +go 1.18 require ( github.com/AlecAivazis/survey/v2 v2.3.2