ci: prevent team to import pkg/errors

Co-authored-by: Gaze <gazenw@users.noreply.github.com>
This commit is contained in:
Gaze
2024-04-02 23:24:34 +07:00
parent 7d49b7bdba
commit e77d401f56
3 changed files with 93 additions and 2 deletions

View File

@@ -51,6 +51,7 @@ linters:
- prealloc # performance - Find slice declarations that could potentially be pre-allocated, https://github.com/alexkohler/prealloc
- gosec # bugs - Inspects source code for security problems
- wrapcheck # style, error - Checks that errors returned from external packages are wrapped, we should wrap the error from external library
- depguard # import - Go linter that checks if package imports are in a list of acceptable packages.
### Annoying Linters
# - dupl # style - code clone detection
@@ -79,8 +80,13 @@ linters-settings:
- .WithStack(
ignoreSigRegexps:
- \.New.*Error\(
ignorePackageGlobs:
- "github.com/gofiber/fiber/*"
goconst:
ignore-tests: true
min-occurrences: 5
depguard:
rules:
main:
# Packages that are not allowed.
deny:
- pkg: "github.com/pkg/errors"
desc: Should be replaced by "cockroachdb/errors" or "cleverse/go-utilities" package

3
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"recommendations": ["dotenv.dotenv-vscode", "golang.go"]
}

82
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,82 @@
{
"editor.formatOnSave": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
},
"search.exclude": {
"**/node_modules": true,
"**/build": true,
"**/dist": true
},
"[json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// Golang
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.codeLens": true
},
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fix"],
"go.lintOnSave": "package",
"go.toolsManagement.autoUpdate": true,
"gopls": {
"formatting.gofumpt": true, // https://github.com/mvdan/gofumpt
"ui.codelenses": {
"gc_details": true
},
"build.directoryFilters": ["-**/node_modules"],
"ui.semanticTokens": true,
"ui.completion.usePlaceholders": false,
"ui.diagnostic.analyses": {
// https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md
// "fieldalignment": false,
"nilness": true,
"shadow": false,
"unusedparams": true,
"unusedvariable": true,
"unusedwrite": true, // ineffective assignment
"useany": true
},
"ui.diagnostic.staticcheck": false, // use golangci-lint instead
"ui.diagnostic.annotations": {
// CMD+P and run command `Go: Toggle gc details`
"bounds": true,
"escape": true,
"inline": true,
"nil": true
},
"ui.documentation.hoverKind": "FullDocumentation"
},
"go.editorContextMenuCommands": {
// Right click on code to use this command
"toggleTestFile": false,
"addTags": false,
"removeTags": false,
"fillStruct": true,
"testAtCursor": false,
"testFile": false,
"testPackage": false,
"generateTestForFunction": true,
"generateTestForFile": false,
"generateTestForPackage": false,
"addImport": false,
"testCoverage": false,
"playground": false,
"debugTestAtCursor": false,
"benchmarkAtCursor": false
},
"dotenv.enableAutocloaking": false,
"protoc": {
"options": ["--proto_path=pb"]
}
}