Skip to content

Commit

Permalink
Use golangci-lint instead of golint
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini committed Sep 27, 2023
1 parent f9ae024 commit 2c92d47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 51 deletions.
16 changes: 3 additions & 13 deletions workflow-templates/assets/check-go-task/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,8 @@ tasks:
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
cmds:
- |
if ! which golint &>/dev/null; then
echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation"
if ! which golangci-lint &>/dev/null; then
echo "golangci-lint not installed or not in PATH. Please install: https://golangci-lint.run/usage/install/"
exit 1
fi
- |
golint \
{{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \
{{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
go:vet:
desc: Check for errors in Go code
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
cmds:
- go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
- golangci-lint run
42 changes: 4 additions & 38 deletions workflow-templates/check-go-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,42 +53,6 @@ jobs:
echo "result=$RESULT" >> $GITHUB_OUTPUT
check-errors:
name: check-errors (${{ matrix.module.path }})
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false

matrix:
module:
# TODO: add paths of all Go modules here
- path: ./

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Check for errors
env:
GO_MODULE_PATH: ${{ matrix.module.path }}
run: task go:vet

check-outdated:
name: check-outdated (${{ matrix.module.path }})
needs: run-determination
Expand Down Expand Up @@ -159,8 +123,10 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install golint
run: go install golang.org/x/lint/golint@latest
- name: Install golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54

- name: Check style
env:
Expand Down

0 comments on commit 2c92d47

Please sign in to comment.