Skip to content

Add golangci-lint Github Action formatter and lint checks #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a87035b
Fix some small issues that were flagged by upcoming lint checks.
rsned Apr 2, 2025
ed507ae
replace the swap edges, newEdges which left a dangling value with _
rsned Apr 2, 2025
39caea7
Add todo on this //nolint.
rsned Apr 2, 2025
69704c9
Add linter/formatter/govet github action.
rsned Apr 2, 2025
12554af
Merge branch 'golang:master' into master
rsned Apr 3, 2025
55902bd
Fix OSSF detected go.mod toolchain version issue.
rsned Apr 3, 2025
4f7483f
update to use git hashes instead of @v5 style.
rsned Apr 4, 2025
e141dbf
Use dependabot compatible version comments
alan-strohm Apr 4, 2025
c597829
Add comments on disabled checks. Add a few more entries.
rsned Apr 8, 2025
5836f6f
Merge branch 'golang:master' into master
rsned Apr 8, 2025
7c7e52c
Merge remote-tracking branch 'refs/remotes/origin/master'
rsned Apr 8, 2025
6df2625
Update some comments and add in reference to related issue number for…
rsned Apr 8, 2025
0f45e9d
Remove govet from enabled. Drop exclusions. Clarify some comments.
rsned Apr 8, 2025
6937d18
Fix some typos
alan-strohm Apr 9, 2025
aeac25e
Set gofmt formatter to keep the default -s (simplify option)
rsned Apr 10, 2025
6570bb0
Re-disable simplify until existing files are fixed.
rsned Apr 10, 2025
46b2465
Update permissions to read-all
rsned Apr 10, 2025
c8d0c06
Remove simply: false from format checks.
rsned Apr 10, 2025
a09abef
Merge branch 'golang:master' into master
rsned Apr 10, 2025
cc51d8b
read-all should be on permissions, not the specific sub element.
rsned Apr 10, 2025
61272a9
Merge remote-tracking branch 'refs/remotes/origin/master'
rsned Apr 10, 2025
f996d29
Merge branch 'golang:master' into master
rsned Apr 12, 2025
63e5133
drop comment on pull requests.
rsned Apr 14, 2025
9a1faa3
Merge remote-tracking branch 'refs/remotes/origin/master'
rsned Apr 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: golangci-lint
on:
push:
branches:
- master
pull_request:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments don't seem relevant anymore.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

# pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.0
35 changes: 35 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "2"
linters:
disable:
- errcheck # TODO(rsned): Enable once outstanding lint bugs are fixed.
- mnd
- paralleltest
- staticcheck # TODO(rsned): Enable once outstanding lint bugs are fixed.
- testpackage
- unused
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
settings:
gofmt:
# Simplify code: gofmt with `-s` option.
# Default: true
simplify: false
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$