Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Sep 15, 2024
1 parent abdd4c3 commit 5b0c645
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 17 deletions.
52 changes: 38 additions & 14 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
run:
linters-settings:
govet:
enable-all: true
linters:
enable-all: true
disable:
- gochecknoglobals
- gomnd
- gocognit
- nestif
- nilnil
- paralleltest
- varnamelen
linters:
enable-all: true
disable:
- execinquery # deprecated
- exportloopref # deprecated
- gomnd # deprecated
- gochecknoglobals
- exhaustruct
- mnd
- gocognit
- nestif
- nilnil
- paralleltest
- varnamelen

linters-settings:
govet:
enable-all: true
perfsprint:
err-error: true
errorf: true
sprintf1: true
strconcat: false
depguard:
rules:
main:
deny:
- pkg: "github.com/instana/testify"
desc: not allowed
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package

output:
show-stats: true
sort-results: true
sort-order:
- linter
- file
1 change: 1 addition & 0 deletions ngfunc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func ngCalledFuncs(pass *analysis.Pass, ngFuncs []*types.Func) []*Report {
if !ok {
panic(fmt.Sprintf("%T is not *buildssa.SSA", pass.ResultOf[buildssa.Analyzer]))
}

for _, sf := range ssa.SrcFuncs {
for _, b := range sf.Blocks {
for _, instr := range b.Instrs {
Expand Down
4 changes: 2 additions & 2 deletions ngfunc/types.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package ngfunc

import (
"fmt"
"errors"
"go/types"
"strings"

"github.com/gostaticanalysis/analysisutil"
"golang.org/x/tools/go/analysis"
)

var errNotFound = fmt.Errorf("function not found")
var errNotFound = errors.New("function not found")

func typeFuncs(pass *analysis.Pass, funcs []string) []*types.Func {
fs := make([]*types.Func, 0, len(funcs))
Expand Down
1 change: 1 addition & 0 deletions noctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package noctx

import (
"fmt"

"github.com/sonatard/noctx/ngfunc"
"github.com/sonatard/noctx/reqwithoutctx"
"golang.org/x/tools/go/analysis"
Expand Down
1 change: 0 additions & 1 deletion reqwithoutctx/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"go/types"

"github.com/gostaticanalysis/analysisutil"

"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/buildssa"
"golang.org/x/tools/go/ssa"
Expand Down

0 comments on commit 5b0c645

Please sign in to comment.