Skip to content

Commit

Permalink
CORE-30 Go-lint (#31)
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit d327883
Author: tavo <[email protected]>
Date:   Tue Oct 20 21:40:17 2020 +0300

    test without extra build

commit ae71e8f
Author: tavo <[email protected]>
Date:   Tue Oct 20 21:21:34 2020 +0300

    Rename action

commit 5a1c0a6
Author: tavo <[email protected]>
Date:   Tue Oct 20 21:14:08 2020 +0300

    Remove unnecessary make

commit 8009581
Author: tavo <[email protected]>
Date:   Tue Oct 20 21:09:17 2020 +0300

    Add correct reporter

commit 4cf98c0
Author: tavo <[email protected]>
Date:   Tue Oct 20 21:04:32 2020 +0300

    remove test

commit e0d1b25
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:54:24 2020 +0300

    test reviewdog for pr

commit 226baad
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:45:04 2020 +0300

    test reviewdog

commit 2927b65
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:40:17 2020 +0300

    test reviewdog

commit 8c819df
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:36:10 2020 +0300

    test

commit dcfab22
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:35:48 2020 +0300

    test

commit 06f3ac2
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:29:24 2020 +0300

    test

commit 3ffcd9c
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:28:09 2020 +0300

    test

commit 032550e
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:26:13 2020 +0300

    test

commit 0ef1e7e
Author: tavo <[email protected]>
Date:   Tue Oct 20 20:13:10 2020 +0300

    test

commit 7d4e16b
Author: tavo <[email protected]>
Date:   Mon Oct 19 18:29:17 2020 +0300

    ...

commit a8e2e14
Author: tavo <[email protected]>
Date:   Mon Oct 19 18:08:29 2020 +0300

    Remove unused function

commit eab5ef5
Author: tavo <[email protected]>
Date:   Mon Oct 19 17:56:55 2020 +0300

    Remove unused function

commit 282cc90
Author: tavo <[email protected]>
Date:   Mon Oct 19 17:47:33 2020 +0300

    test

commit 776ce14
Author: tavo <[email protected]>
Date:   Mon Oct 19 10:57:56 2020 +0300

    Working, yay

commit 48772e7
Author: tavo <[email protected]>
Date:   Mon Oct 19 10:51:35 2020 +0300

    test

commit 392bded
Author: tavo <[email protected]>
Date:   Mon Oct 19 10:46:10 2020 +0300

    test

commit 91d530c
Author: tavo <[email protected]>
Date:   Mon Oct 19 10:36:19 2020 +0300

    no modules download

commit 271f330
Author: tavo <[email protected]>
Date:   Mon Oct 19 10:35:49 2020 +0300

    gomodule on

commit b4d0fcd
Author: tavo <[email protected]>
Date:   Mon Oct 19 10:28:01 2020 +0300

    test v2

commit 0ae3bc0
Author: tavo <[email protected]>
Date:   Mon Oct 19 10:06:06 2020 +0300

    test v1

commit 4ff453e
Author: tavo <[email protected]>
Date:   Mon Oct 19 09:59:05 2020 +0300

    Test

commit ac46180
Author: tavo <[email protected]>
Date:   Mon Oct 19 09:50:43 2020 +0300

    remove pwd

commit ee1ec6b
Author: tavo <[email protected]>
Date:   Mon Oct 19 09:45:49 2020 +0300

    Test with apt deps

commit e137ed8
Author: tavo <[email protected]>
Date:   Sun Oct 18 21:53:46 2020 +0300

    Add working directory

commit f8ef214
Author: tavo <[email protected]>
Date:   Sun Oct 18 21:49:34 2020 +0300

    Add workinf directory

commit 2b52e10
Author: tavo <[email protected]>
Date:   Sun Oct 18 21:39:55 2020 +0300

    Add GOPATH

commit 49db51d
Author: tavo <[email protected]>
Date:   Sun Oct 18 21:37:30 2020 +0300

    Fix bad ide wrong paste

commit d080bb5
Author: tavo <[email protected]>
Date:   Sun Oct 18 21:36:17 2020 +0300

    Add explicit go install

commit 0bf144b
Author: tavo <[email protected]>
Date:   Sun Oct 18 21:34:37 2020 +0300

    Try now

commit fb8b07e
Author: tavo <[email protected]>
Date:   Sun Oct 18 21:25:29 2020 +0300

    Add lint workflow
  • Loading branch information
kilpkonn committed Oct 21, 2020
1 parent 823e385 commit 813523e
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 239 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.go text eol=lf
4 changes: 0 additions & 4 deletions .github/workflows/develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ jobs:
cd vendor/libgit2
mkdir build && cd build
cmake ..
make
sudo make install
cd ../../..
make install-static
cd $GOPATH
Expand Down Expand Up @@ -135,8 +133,6 @@ jobs:
cd vendor/libgit2
mkdir build && cd build
cmake ..
make
sudo make install
cd ../../..
make install-static
cd $GOPATH
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Reviewdog
on:
push:
branches:
- develop
- master
pull_request:
branches:
- develop
- master
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: auto
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
- uses: actions/checkout@v2
with:
path: ./src/github.com/${{ github.repository }}
submodules: true
- name: Install apt dependecies
run: |
sudo apt-get install libgit2-dev libssh2-1-dev libssl-dev cmake
- name: Install go dependencies
run: |
go get -d github.com/Masterminds/sprig
- name: Install git2go
run: |
go get -d github.com/libgit2/git2go
cd $GOPATH/src/github.com/libgit2/git2go
git submodule update --init # get libgit2
cd vendor/libgit2
mkdir build && cd build
cmake ..
cd ../../..
make install-static
go get -v -d github.com/kilpkonn/gtm-enhanced
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v1
with:
# Can pass --config flag to change golangci-lint behavior and target
# directory.
tool_name: Reviewdog
reporter: github-pr-check
golangci_lint_flags: "--config=.golangci.yml"
workdir: src/github.com/kilpkonn/gtm-enhanced
4 changes: 0 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
cd vendor/libgit2
mkdir build && cd build
cmake ..
make
sudo make install
cd ../../..
make install-static
cd $GOPATH
Expand Down Expand Up @@ -186,8 +184,6 @@ jobs:
cd vendor/libgit2
mkdir build && cd build
cmake ..
make
sudo make install
cd ../../..
make install-static
cd $GOPATH
Expand Down
142 changes: 142 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
lines: 180
statements: 80
gci:
local-prefixes: github.com/golangci/golangci-lint
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 18
goimports:
local-prefixes: github.com/golangci/golangci-lint
golint:
min-confidence: 0
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 100
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped

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
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exhaustive
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- lll
- misspell
- nakedret
- noctx
- nolintlint
- rowserrcheck
- scopelint
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

# don't enable:
# - asciicheck
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- dupl
- funlen
- lll

# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"


run:
# default concurrency is a available CPU number
concurrency: 4
# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 4m
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

90 changes: 0 additions & 90 deletions Makefile

This file was deleted.

Loading

0 comments on commit 813523e

Please sign in to comment.