mirror of
https://github.com/logos-messaging/go-libp2p-rendezvous.git
synced 2026-01-02 04:43:11 +00:00
feat: add golangci lint
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
This commit is contained in:
parent
9eac124763
commit
d1e00a6a49
112
.github/workflows/go.yml
vendored
Normal file
112
.github/workflows/go.yml
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
name: Go
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
golangci-lint:
|
||||
name: "GolangCI-lint"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
golang:
|
||||
- 1.18.x
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.golang }}
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3.3.0
|
||||
with:
|
||||
go-version: ${{ matrix.golang }}
|
||||
version: v1.50.1
|
||||
args: --timeout=10m
|
||||
|
||||
go-tests-on-linux:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
golang:
|
||||
- 1.18
|
||||
- 1.19
|
||||
env:
|
||||
OS: ubuntu-latest
|
||||
GOLANG: ${{ matrix.golang }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.golang }}
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{matrix.golang}}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-${{matrix.golang}}-
|
||||
- name: Download modules
|
||||
run: go mod download
|
||||
- name: Check go.mod and go.sum
|
||||
run: |
|
||||
go mod tidy -v
|
||||
git --no-pager diff go.mod go.sum
|
||||
git --no-pager diff --quiet go.mod go.sum
|
||||
- name: Run tests with race, without goleak
|
||||
run: go test -race -covermode=atomic -coverpkg=all -coverprofile=coverage.txt -cover -v ./... -test.timeout=10m
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
file: ./coverage.txt
|
||||
flags: unittests
|
||||
env_vars: OS,GOLANG
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
go-tests-on-macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
golang:
|
||||
- 1.18
|
||||
- 1.19
|
||||
env:
|
||||
OS: macos-latest
|
||||
GOLANG: ${{ matrix.golang }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.golang }}
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-${{matrix.golang}}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{matrix.golang}}-go-
|
||||
- name: Download modules
|
||||
run: go mod download
|
||||
- name: Check go.mod and go.sum
|
||||
run: |
|
||||
go mod tidy -v
|
||||
git --no-pager diff go.mod go.sum
|
||||
git --no-pager diff --quiet go.mod go.sum
|
||||
- name: Run tests with race, without goleak
|
||||
run: go test -race -covermode=atomic -coverpkg=all -coverprofile=coverage.txt -cover -v ./... -test.timeout=10m
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
file: ./coverage.txt
|
||||
flags: unittests
|
||||
env_vars: OS,GOLANG
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
29
.golangci.yml
Normal file
29
.golangci.yml
Normal file
@ -0,0 +1,29 @@
|
||||
run:
|
||||
deadline: 1m
|
||||
tests: true
|
||||
|
||||
linters-settings:
|
||||
golint:
|
||||
min-confidence: 0
|
||||
maligned:
|
||||
suggest-new: true
|
||||
goconst:
|
||||
min-len: 5
|
||||
min-occurrences: 4
|
||||
misspell:
|
||||
locale: US
|
||||
|
||||
linters:
|
||||
disable-all: false
|
||||
enable:
|
||||
- goconst
|
||||
- misspell
|
||||
- misspell
|
||||
- errcheck
|
||||
- unused
|
||||
- staticcheck
|
||||
- unconvert
|
||||
- gofmt
|
||||
- goimports
|
||||
- revive
|
||||
- ineffassign
|
||||
Loading…
x
Reference in New Issue
Block a user