This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lint to GitHub Actions. Fix lint errors.
- Loading branch information
Showing
12 changed files
with
107 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Optional workflow for Go Static Code Analysis check, | ||
# copy this file to yours <repo>/.github/workflows folder only if you need this. | ||
# See https://mailgun.atlassian.net/wiki/spaces/ENG/pages/4278943767/Go+Static+Code+Analysis+Linters | ||
|
||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
pull_request: | ||
|
||
env: | ||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | ||
GOLANGCI_LINT_VERSION: v1.54.2 | ||
|
||
jobs: | ||
lint: | ||
name: lint | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
cache: true # caching and restoring go modules and build outputs | ||
|
||
- name: Setup SSH key | ||
run: | | ||
mkdir -p ~/.ssh | ||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | ||
ssh-add - <<< "${{ secrets.CI_SSH_KEY }}" | ||
ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
- name: Configure git for private modules | ||
run: | | ||
git config --global url.ssh://[email protected]/.insteadOf https://github.com/ | ||
go env -w GOPRIVATE=github.com/mailgun | ||
- name: Check that 'go mod tidy' was called before commit | ||
run: go mod tidy && git diff --exit-code | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: ${{ env.GOLANGCI_LINT_VERSION }} | ||
skip-cache: true # cache/restore is done by actions/setup-go@v3 step | ||
args: -v |
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
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
Oops, something went wrong.