Skip to content

Commit

Permalink
Add go lint (#10)
Browse files Browse the repository at this point in the history
This is the simple use of golangci-lint-action.

The enabled by default linters as follows:
errcheck, gosimple, govet, ineffassign, staticcheck, unused.

The gosec, goimports are included in the linters.

Signed-off-by: Sophia Wang <[email protected]>
  • Loading branch information
huiwangredhat authored Nov 22, 2024
1 parent 3983dd5 commit ed4e7f8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/go_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
10 changes: 10 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
linters:
enable:
- errcheck # Checks for unchecked errors
- gosimple # Finds code simplifications
- govet # Vet checks for various errors
- ineffassign # Finds useless assignments
- staticcheck # Comprehensive static analysis
- unused # Finds unused variables, functions, etc.
- gosec # Security checks for Go code
- goimports # Checks import statements are formatted

0 comments on commit ed4e7f8

Please sign in to comment.