mirror of
https://github.com/fumiama/orbyte.git
synced 2026-06-05 02:00:30 +08:00
feat: add lint
This commit is contained in:
43
.github/workflows/go-vet.yml
vendored
Normal file
43
.github/workflows/go-vet.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: golang-ci
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: CI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set up Go 1.x
|
||||||
|
uses: actions/setup-go@master
|
||||||
|
with:
|
||||||
|
go-version: ^1.23
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@master
|
||||||
|
|
||||||
|
- name: Get dependencies
|
||||||
|
run: go mod tidy
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: go build -v ./...
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: go test $(go list ./...)
|
||||||
|
|
||||||
|
golangci:
|
||||||
|
name: lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Set up Go 1.x
|
||||||
|
uses: actions/setup-go@master
|
||||||
|
with:
|
||||||
|
go-version: ^1.23
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@master
|
||||||
|
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@master
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
68
.golangci.yml
Normal file
68
.golangci.yml
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
linters-settings:
|
||||||
|
errcheck:
|
||||||
|
ignore: fmt:.*,io/ioutil:^Read.*
|
||||||
|
ignoretests: true
|
||||||
|
|
||||||
|
goimports:
|
||||||
|
local-prefixes: github.com/fumiama/orbyte
|
||||||
|
|
||||||
|
linters:
|
||||||
|
# please, do not use `enable-all`: it's deprecated and will be removed soon.
|
||||||
|
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||||
|
disable-all: true
|
||||||
|
fast: false
|
||||||
|
enable:
|
||||||
|
- bodyclose
|
||||||
|
#- depguard
|
||||||
|
- dogsled
|
||||||
|
- errcheck
|
||||||
|
#- exportloopref
|
||||||
|
- exhaustive
|
||||||
|
#- funlen
|
||||||
|
#- goconst
|
||||||
|
- gocritic
|
||||||
|
#- gocyclo
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
- goprintffuncname
|
||||||
|
#- gosec
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
#- misspell
|
||||||
|
- nolintlint
|
||||||
|
- rowserrcheck
|
||||||
|
- staticcheck
|
||||||
|
- stylecheck
|
||||||
|
- typecheck
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- unused
|
||||||
|
- whitespace
|
||||||
|
- prealloc
|
||||||
|
- predeclared
|
||||||
|
- asciicheck
|
||||||
|
- revive
|
||||||
|
- forbidigo
|
||||||
|
- makezero
|
||||||
|
|
||||||
|
|
||||||
|
run:
|
||||||
|
# default concurrency is a available CPU number.
|
||||||
|
# concurrency: 4 # explicitly omit this value to fully utilize available resources.
|
||||||
|
deadline: 5m
|
||||||
|
issues-exit-code: 1
|
||||||
|
tests: false
|
||||||
|
go: '1.23'
|
||||||
|
|
||||||
|
# output configuration options
|
||||||
|
output:
|
||||||
|
formats:
|
||||||
|
- format: "colored-line-number"
|
||||||
|
print-issued-lines: true
|
||||||
|
print-linter-name: true
|
||||||
|
uniq-by-line: true
|
||||||
|
|
||||||
|
issues:
|
||||||
|
# Fix found issues (if it's supported by the linter)
|
||||||
|
fix: true
|
||||||
Reference in New Issue
Block a user