添加golangci-lint配置

This commit is contained in:
GoEdgeLab
2023-08-08 18:32:58 +08:00
parent 1f39947a89
commit f1fa608dcd
9 changed files with 84 additions and 9 deletions

75
.golangci.yaml Normal file
View File

@@ -0,0 +1,75 @@
# https://golangci-lint.run/usage/configuration/
linters:
enable-all: true
disable:
- ifshort
- exhaustivestruct
- golint
- nosnakecase
- scopelint
- varcheck
- structcheck
- interfacer
- exhaustivestruct
- maligned
- deadcode
- dogsled
- wrapcheck
- wastedassign
- varnamelen
- testpackage
- thelper
- nilerr
- sqlclosecheck
- paralleltest
- nonamedreturns
- nlreturn
- nakedret
- ireturn
- interfacebloat
- gosmopolitan
- gomnd
- goerr113
- gochecknoglobals
- exhaustruct
- errorlint
- depguard
- exhaustive
- containedctx
- wsl
- cyclop
- dupword
- errchkjson
- contextcheck
- tagalign
- dupl
- forbidigo
- funlen
- goconst
- godox
- gosec
- lll
- nestif
- revive
- unparam
- stylecheck
- gocritic
- gofumpt
- gomoddirectives
- godot
- gofmt
- gocognit
- mirror
- gocyclo
- gochecknoinits
- gci
- maintidx
- prealloc
- goimports
- errname
- musttag
- forcetypeassert
- whitespace
- noctx
- reassign

View File

@@ -107,7 +107,7 @@ func MatchPath(action *actions.ActionObject, path string) bool {
// FindParentAction 查找父级Action // FindParentAction 查找父级Action
func FindParentAction(actionPtr actions.ActionWrapper) *ParentAction { func FindParentAction(actionPtr actions.ActionWrapper) *ParentAction {
action, ok := actionPtr.(interface{ action, ok := actionPtr.(interface {
Parent() *ParentAction Parent() *ParentAction
}) })
if ok { if ok {
@@ -140,7 +140,7 @@ func findStack(err string) string {
filename = filename[strings.Index(filename, "src"):] filename = filename[strings.Index(filename, "src"):]
} }
err += "\n\t\t" + string(filename) + ":" + fmt.Sprintf("%d", lineNo) err += "\n\t\t" + filename + ":" + fmt.Sprintf("%d", lineNo)
break break
} }

View File

@@ -1,4 +1,4 @@
package recover package recovers
import ( import (
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"

View File

@@ -1,6 +1,6 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. // Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package recover package recovers
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"

View File

@@ -1,4 +1,4 @@
package recover package recovers
import "github.com/iwind/TeaGo" import "github.com/iwind/TeaGo"

View File

@@ -1,6 +1,6 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. // Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package recover package recovers
import ( import (
"bytes" "bytes"

View File

@@ -1,4 +1,4 @@
package recover package recovers
import ( import (
"encoding/json" "encoding/json"

View File

@@ -1,4 +1,4 @@
package delete package deletes
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"

View File

@@ -1,4 +1,4 @@
package delete package deletes
import ( import (
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/configloaders"