-
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.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 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,17 @@ | ||
run: | ||
go: '1.19' | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- gofumpt | ||
|
||
issues: | ||
# Show only new issues: if there are unstaged changes or untracked files, | ||
# only those changes are analyzed, else only changes in HEAD~ are analyzed. | ||
# It's a super-useful option for integration of golangci-lint into existing large codebase. | ||
# It's not practical to fix all existing issues at the moment of integration: | ||
# much better don't allow issues in new code. | ||
# | ||
# Default: false | ||
new: true |
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,35 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
|
||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history for all branches and tags | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
- name: Find base branch | ||
id: find_base_branch | ||
run: | | ||
BASE_BRANCH=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)") | ||
if [ -z "$BASE_BRANCH" ]; then | ||
echo "BASE_BRANCH=origin/main" >> $GITHUB_ENV # Default to main if no upstream is set | ||
else | ||
echo "BASE_BRANCH=$BASE_BRANCH" >> $GITHUB_ENV | ||
fi | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.59 | ||
args: --config .github/workflows/.golangci.yml --new-from-rev ${{ env.BASE_BRANCH }} |