Skip to content

Commit

Permalink
set a .go-version from file, set as output in github actions, set up …
Browse files Browse the repository at this point in the history
…golangci-lint so we can get to lint checks and fieldalignement
  • Loading branch information
ramin committed Nov 22, 2023
1 parent 28ff21c commit 25c05d5
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
37 changes: 36 additions & 1 deletion .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
Expand Down
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.21
72 changes: 72 additions & 0 deletions .golangci.yml
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

0 comments on commit 25c05d5

Please sign in to comment.