This repository has been archived by the owner on Mar 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from iden3/feature/golinter
Add github action for Go linting
- Loading branch information
Showing
4 changed files
with
37 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: [ pull_request ] | ||
name: Lint | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: git fetch origin master | ||
|
||
- name: Check if must run | ||
id: check | ||
run: | | ||
git diff origin/master -- go > changes | ||
if [ -s changes ]; then | ||
echo ::set-output name=shouldRun::yes | ||
echo "The Go code has changed. The linter will be executed." | ||
else | ||
echo "The Go code has NOT changed. The linter will NOT be executed." | ||
fi | ||
- name: Install Go | ||
if: steps.check.outputs.shouldRun == 'yes' | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14.x | ||
|
||
- name: Lint | ||
if: steps.check.outputs.shouldRun == 'yes' | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0 | ||
cd go && $(go env GOPATH)/bin/golangci-lint run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters