ci: improve golangci static check (#1387)

* ci: improve golangci static check
pull/1394/head
Kagaya 3 years ago committed by GitHub
parent e3d55b74bd
commit c55528f321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 61
      .github/workflows/go.yml
  2. 51
      .golangci.yml

@ -2,9 +2,11 @@ name: Go
on: on:
push: push:
branches: [ main ] branches:
- main
pull_request: pull_request:
branches: [ main ] branches:
- main
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@ -24,38 +26,38 @@ jobs:
- 8500:8500 - 8500:8500
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.16 go-version: 1.16
- name: Build - name: Build
run: go build ./... run: go build ./...
- name: Test - name: Test
run: go test -race -coverprofile=coverage.out -covermode=atomic ./... run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash) run: bash <(curl -s https://codecov.io/bash)
- name: Kratos - name: Kratos
run: | run: |
cd cmd/kratos cd cmd/kratos
go build ./... go build ./...
go test ./... go test ./...
- name: HTTP - name: HTTP
run: | run: |
cd cmd/protoc-gen-go-http cd cmd/protoc-gen-go-http
go build ./... go build ./...
go test ./... go test ./...
- name: Examples - name: Examples
run: | run: |
cd examples cd examples
go build ./... go build ./...
go test ./... go test ./...
lint: lint:
name: lint name: lint
@ -65,8 +67,7 @@ jobs:
- name: Lint - name: Lint
uses: golangci/golangci-lint-action@v2 uses: golangci/golangci-lint-action@v2
with: with:
version: v1.41 version: v1.42
args: --disable-all
skip-go-installation: true skip-go-installation: true
skip-pkg-cache: true skip-pkg-cache: true
only-new-issues: true only-new-issues: true

@ -1,14 +1,55 @@
run: run:
timeout: 5m timeout: 5m
modules-download-mode: readonly modules-download-mode: readonly
skip-files:
- ".*_test\\.go$"
linters: linters:
disable-all: true
fast: false
enable: enable:
- revive - bodyclose
- staticcheck - deadcode
- dogsled
- durationcheck
- errcheck
- exportloopref
- govet - govet
- gosimple - gosimple
- gofmt - gofmt
- errcheck - gofumpt
- goconst
- goimports
- gomnd
- ineffassign
- lll
- prealloc
- revive
- staticcheck
- structcheck
- typecheck
- unused
- unconvert
- varcheck
- whitespace
- wastedassign
# don't enable:
# - asciicheck
# - scopelint
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
# - testpackage
# - stylrcheck
# - wsl
linters-settings:
govet:
check-shadowing: true
whitespace:
multi-func: true

Loading…
Cancel
Save