-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linting to the pre-merge checks to enforce Go import groups: - stdlib - 3rd-party / non-Pebble imports - Pebble imports
- Loading branch information
1 parent
491b694
commit bd46b08
Showing
2 changed files
with
44 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,14 @@ | ||
linters: | ||
disable-all: true | ||
enable: | ||
- gci | ||
linters-settings: | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- Prefix(github.com/canonical/pebble) | ||
issues: | ||
# these values ensure that all issues will be surfaced | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 |
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,30 @@ | ||
name: Lint | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-mod-file: 'go.mod' | ||
cache: false | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
id: lint | ||
with: | ||
version: latest | ||
args: '-c .github/.golangci.yml --out-format=colored-line-number' | ||
skip-cache: true | ||
|
||
- name: Print error message | ||
if: always() && steps.lint.outcome == 'failure' | ||
run: | | ||
echo ' | ||
Linting failed. On your local machine, please run | ||
golangci-lint run -c .github/.golangci.yml --fix | ||
and check in the changes.' | ||
exit 1 |