-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set a .go-version from file, set as output in github actions, set up …
…golangci-lint so we can get to lint checks and fieldalignement
- Loading branch information
Showing
3 changed files
with
109 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -5,18 +5,53 @@ on: | |
- v* | ||
branches: | ||
- main | ||
- chore/ramin/field-alignment | ||
pull_request: | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
go-version: ${{ steps.go-version.outputs.version }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Read .go-version file | ||
id: go-version | ||
run: echo "version=$(cat .go-version)" >> $GITHUB_ENV | ||
|
||
lint: | ||
needs: [setup] | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ needs.setup.outputs.go-version }} | ||
|
||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
args: --timeout 10m | ||
version: v1.55 | ||
skip-pkg-cache: true | ||
skip-build-cache: true | ||
|
||
build: | ||
needs: [lint] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21 | ||
go-version: ${{ needs.setup.outputs.go-version }} | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
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 @@ | ||
1.21 |
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,72 @@ | ||
run: | ||
timeout: 5m | ||
|
||
linters: | ||
enable: | ||
- bodyclose | ||
# - depguard as of v1.54.2, the default config throws errors on our repo | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
# - funlen | ||
# - gochecknoglobals | ||
# - gochecknoinits | ||
- goconst | ||
- gocritic | ||
# - gocyclo | ||
# - godox | ||
- gofmt | ||
- goimports | ||
# - golint - deprecated since v1.41. revive will be used instead | ||
- revive | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
# - interfacer | ||
- lll | ||
- misspell | ||
# - maligned | ||
- nakedret | ||
- prealloc | ||
# - scopelint - deprecated since v1.39. exportloopref will be used instead | ||
- exportloopref | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
# - unparam | ||
- unused | ||
# - whitespace | ||
# - wsl | ||
# - gocognit | ||
- nolintlint | ||
- asciicheck | ||
|
||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- gosec | ||
- govet | ||
- linters: | ||
- lll | ||
source: "https://" | ||
max-same-issues: 50 | ||
|
||
linters-settings: | ||
dogsled: | ||
max-blank-identifiers: 3 | ||
golint: | ||
min-confidence: 0 | ||
maligned: | ||
suggest-new: true | ||
misspell: | ||
locale: US | ||
goimports: | ||
local-prefixes: github.com/celestiaorg/celestia-node | ||
dupl: | ||
threshold: 200 | ||
govet: | ||
enable: | ||
- fieldalignment |