-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix lint issues and move net/dial files to net (#31)
- Loading branch information
Showing
29 changed files
with
417 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
pull-requests: read | ||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
cache: false | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v4 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: v1.57 | ||
|
||
# Optional: golangci-lint command line arguments. | ||
# args: --issues-exit-code=0 | ||
|
||
# Optional: show only new issues if it's a pull request. The default value is `false`. | ||
# only-new-issues: true | ||
|
||
# Optional: if set to true then the all caching functionality will be complete disabled, | ||
# takes precedence over all other caching options. | ||
# skip-cache: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/go/pkg. | ||
# skip-pkg-cache: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build. | ||
# skip-build-cache: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
service: | ||
golangci-lint-version: 1.57.x # use the fixed version to not introduce new linters unexpectedly | ||
|
||
run: | ||
concurrency: 4 | ||
# timeout for analysis, e.g. 30s, 5m, default is 1m | ||
deadline: 20m | ||
build-tags: | ||
- integ | ||
- integfuzz | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- unused | ||
- errcheck | ||
- exportloopref | ||
- gocritic | ||
- gofumpt | ||
- goimports | ||
- revive | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- gci | ||
- gosec | ||
- asciicheck | ||
- prealloc | ||
- predeclared | ||
- makezero | ||
fast: false | ||
|
||
linters-settings: | ||
errcheck: | ||
# report about not checking of errors in type assetions: `a := b.(MyStruct)`; | ||
# default is false: such cases aren't reported by default. | ||
check-type-assertions: false | ||
|
||
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; | ||
# default is false: such cases aren't reported by default. | ||
check-blank: false | ||
govet: | ||
# report about shadowed variables | ||
check-shadowing: false | ||
maligned: | ||
# print struct with more effective memory layout or not, false by default | ||
suggest-new: true | ||
misspell: | ||
# Correct spellings using locale preferences for US or UK. | ||
# Default is to use a neutral variety of English. | ||
# Setting locale to US will correct the British spelling of 'colour' to 'color'. | ||
locale: US | ||
ignore-words: | ||
- cancelled | ||
- marshalled | ||
lll: | ||
# max line length, lines longer will be reported. Default is 120. | ||
# '\t' is counted as 1 character by default, and can be changed with the tab-width option | ||
line-length: 160 | ||
# tab width in spaces. Default to 1. | ||
tab-width: 1 | ||
gocritic: | ||
disabled-checks: | ||
- exitAfterDefer | ||
unused: | ||
check-exported: false | ||
unparam: | ||
# Inspect exported functions, default is false. Set to true if no external program/library imports your code. | ||
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: | ||
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations | ||
# with golangci-lint call it on a directory with the changed file. | ||
check-exported: false | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(github.com/fatedier/golib/) | ||
gosec: | ||
severity: "low" | ||
confidence: "low" | ||
excludes: | ||
- G505 | ||
|
||
issues: | ||
# List of regexps of issue texts to exclude, empty list by default. | ||
# But independently from this option we use default exclude patterns, | ||
# it can be disabled by `exclude-use-default: false`. To list all | ||
# excluded by default patterns execute `golangci-lint run --help` | ||
# exclude: | ||
# - composite literal uses unkeyed fields | ||
|
||
exclude-rules: | ||
# Exclude some linters from running on test files. | ||
- path: _test\.go$|^tests/|^samples/ | ||
linters: | ||
- errcheck | ||
- maligned | ||
- linters: | ||
- revive | ||
text: "unused-parameter" | ||
- linters: | ||
- unparam | ||
text: "is always" | ||
- linters: | ||
- staticcheck | ||
text: "SA6002" | ||
- linters: | ||
- staticcheck | ||
text: "snappy.NewWriter is deprecated" | ||
|
||
exclude-dirs: | ||
- genfiles$ | ||
- vendor$ | ||
- bin$ | ||
exclude-files: | ||
- ".*\\.pb\\.go" | ||
- ".*\\.gen\\.go" | ||
|
||
# Independently from option `exclude` we use default exclude patterns, | ||
# it can be disabled by this option. To list all | ||
# excluded by default patterns execute `golangci-lint run --help`. | ||
# Default value for this option is true. | ||
exclude-use-default: true | ||
|
||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50. | ||
max-per-linter: 0 | ||
|
||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3. | ||
max-same-issues: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.