Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Adds staticcheck and unused lint check #41

Merged
merged 1 commit into from
Jan 4, 2024
Merged

chore: Adds staticcheck and unused lint check #41

merged 1 commit into from
Jan 4, 2024

Conversation

gruyaume
Copy link
Contributor

@gruyaume gruyaume commented Jan 4, 2024

Description

Enables the staticcheck and unused lint checks and makes the necessary changes to satisfy those.

@onf-bot
Copy link
Contributor

onf-bot commented Jan 4, 2024

Can one of the admins verify this patch?

1 similar comment
@onf-bot
Copy link
Contributor

onf-bot commented Jan 4, 2024

Can one of the admins verify this patch?

@gab-arrobo
Copy link
Contributor

ok to test

Copy link
Contributor

@gab-arrobo gab-arrobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I know io/ioutil is deprecated. So, os should be used instead, but for some reason I do not see that this change is needed for the lint check to pass when staticcheck and unused are enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is strange, here's the golang ci output when I enable those checks and prior to making the changes:

guillaume@potiron:~/code/udr$ golangci-lint run -v --config ./.golangci.yml
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 14 linters: [asciicheck bodyclose dogsled godox gofmt govet ineffassign misspell nakedret noctx predeclared staticcheck unconvert unused] 
INFO [loader] Go packages loading at mode 575 (types_sizes|deps|files|imports|name|compiled_files|exports_file) took 142.052844ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 3.366162ms 
INFO [linters_context/goanalysis] analyzers took 178.55217ms with top 10 stages: buildir: 102.73302ms, buildssa: 55.782148ms, gofmt: 1.216444ms, nilness: 1.179526ms, fact_purity: 1.0634ms, misspell: 939.943µs, SA5012: 916.323µs, fact_deprecated: 884.799µs, printf: 858.124µs, typedness: 850.968µs 
INFO [runner] Processors filtering stat (out/in): max_same_issues: 4/4, path_prettifier: 4/4, diff: 4/4, skip_dirs: 4/4, identifier_marker: 4/4, exclude: 4/4, uniq_by_line: 4/4, max_per_file_from_linter: 4/4, severity-rules: 4/4, filename_unadjuster: 4/4, skip_files: 4/4, sort_results: 4/4, autogenerated_exclude: 4/4, path_prefixer: 4/4, nolint: 4/4, max_from_linter: 4/4, source_code: 4/4, path_shortener: 4/4, fixer: 4/4, cgo: 4/4, exclude-rules: 4/4 
INFO [runner] processing took 676.194µs with stages: nolint: 489.072µs, identifier_marker: 57.408µs, autogenerated_exclude: 38.8µs, source_code: 33.463µs, path_prettifier: 27.734µs, skip_dirs: 11.985µs, skip_files: 6.97µs, cgo: 2.341µs, max_same_issues: 1.969µs, uniq_by_line: 1.312µs, path_shortener: 1.078µs, max_from_linter: 902ns, severity-rules: 753ns, filename_unadjuster: 717ns, max_per_file_from_linter: 629ns, fixer: 263ns, exclude-rules: 236ns, diff: 190ns, exclude: 174ns, sort_results: 113ns, path_prefixer: 85ns 
INFO [runner] linters took 250.163303ms with stages: goanalysis_metalinter: 249.434163ms 
factory/factory.go:15:2: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
        "io/ioutil"
        ^
service/init.go:46:3: field `heartBeatTimer` is unused (unused)
                heartBeatTimer string
                ^
service/init.go:368:4: SA4006: this value of `err` is never used (staticcheck)
                        nfProfile, err = udr.BuildAndSendRegisterNFInstance()
                        ^
service/init.go:372:3: SA4006: this value of `err` is never used (staticcheck)
                nfProfile, err = udr.BuildAndSendRegisterNFInstance()
                ^
INFO File cache stats: 5 entries of total size 24.8KiB 
INFO Memory: 5 samples, avg is 77.9MB, max is 161.3MB 
INFO Execution took 398.976934ms  

@gab-arrobo gab-arrobo merged commit d871d55 into omec-project:master Jan 4, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants