Skip to content

Commit

Permalink
feat: add golangci workflow with some linters
Browse files Browse the repository at this point in the history
This implements the golangci-lint workflow to new PRs.
It includes a limited number of enabled linters including:
- errcheck
- errname
- gofmt
- gofumpt
- gosimple
- misspell

Signed-off-by: mikeee <[email protected]>
  • Loading branch information
mikeee committed Oct 8, 2023
1 parent 79db5a4 commit 5a63d0c
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@ jobs:
run: |
echo "::warning::Feature branch does not contain any changes to the website."
lint_go:
name: Run Go Linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"

- name: Update go modules
working-directory: ./v2
run: go mod tidy

- name: Run Linter
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
working-directory: ./v2
args: --timeout=10m0s --config ./.golangci.yml

test_go:
name: Run Go Tests
runs-on: ${{ matrix.os }}
Expand Down
162 changes: 162 additions & 0 deletions v2/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Options for analysis runner.
run:
# Custom concurrency value
concurrency: 4

# Execution timeout
timeout: 10m

# Exit code when an issue is found.
issues-exit-code: 1

# Inclusion of test files
tests: false

modules-download-mode: readonly

allow-parallel-runners: false

go: '1.21'


output:
# Runner output format
format: tab

# Print line of issue code
print-issued-lines: false

# Append linter to the output
print-linter-name: true

# Separate issues by line
uniq-by-line: true

# Output path prefixing
path-prefix: ""

# Sort results
sort-results: true


# Specific linter configs
linters-settings:
errcheck:
check-type-assertions: false
check-blank: false
ignore: fmt:.*
disable-default-exclusions: false

gofmt:
simplify: true

gofumpt:
extra-rules: false

linters:
fast: false
# Enable all available linters.
enable-all: true
# Disable specific linters
disable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- cyclop
- deadcode
- decorder
- depguard
- dogsled
- dupl
- dupword
- durationcheck
- errchkjson
- errorlint
- execinquery
- exhaustive
- exhaustivestruct
- exhaustruct
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- goheader
- goimports
- golint
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- govet
- grouper
- ifshort
- importas
- ineffassign
- interfacebloat
- interfacer
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- maligned
- mirror
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosnakecase
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
- reassign
- revive
- rowserrcheck
- scopelint
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- tagalign
- tagliatelle
- tenv
- testableexamples
- testpackage
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- varcheck
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
- zerologlint
10 changes: 10 additions & 0 deletions v2/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
version: "3"

tasks:
download:
summary: Run go mod tidy
cmds:
- go mod tidy

lint:
summary: Run golangci-lint
cmds:
- golangci-lint run ./... --timeout=3m -v

release:
summary: Release a new version of Task. Call with `task v2:release -- <version>`
dir: tools/release
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support for setting some of the Webview preferences, `textInteractionEnabled` and `tabFocusesLinks` on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2937)
- Added support for enabling/disabling fullscreen of the Webview on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2953)
- Added French README.fr.md page. Added by @nejos97 in [PR](https://github.com/wailsapp/wails/pull/2943)
- New task created for linting v2 `task v2:lint`. Workflow updated to run the task. Added by @mikeee in [PR](https://github.com/wailsapp/wails/pull/2957)

### Changed

Expand Down

0 comments on commit 5a63d0c

Please sign in to comment.