imported but not used (typecheck) #2863
Replies: 6 comments 10 replies
-
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Beta Was this translation helpful? Give feedback.
-
Hello, I don't reproduce your problem: $ go version
go version go1.17.10 linux/amd64
$ golangci-lint version
golangci-lint has version 1.46.1 built from 044f0a17 on 2022-05-12T09:23:45Z
$ git clone [email protected]:apache/dubbo-go.git
Cloning into 'dubbo-go'...
remote: Enumerating objects: 49874, done.
remote: Counting objects: 100% (46/46), done.
remote: Compressing objects: 100% (35/35), done.
remote: Total 49874 (delta 17), reused 22 (delta 10), pack-reused 49828
Receiving objects: 100% (49874/49874), 86.32 MiB | 14.69 MiB/s, done.
Resolving deltas: 100% (31473/31473), done.
$ cd ./dubbo-go
$ golangci-lint run -v --timeout=5m
INFO [config_reader] Config search paths: [./ /home/ldez/sources/experimental/dubbo-go /home/ldez/sources/experimental /home/ldez/sources /home/ldez /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 4 linters: [govet ineffassign misspell staticcheck]
INFO [loader] Go packages loading at mode 575 (exports_file|files|types_sizes|compiled_files|deps|imports|name) took 1.801636414s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 41.27123ms
INFO [linters context/goanalysis] analyzers took 0s with no stages
INFO [runner] Issues before processing: 169, after processing: 0
INFO [runner] Processors filtering stat (out/in): skip_files: 169/169, identifier_marker: 88/88, filename_unadjuster: 169/169, path_prettifier: 169/169, cgo: 169/169, skip_dirs: 169/169, exclude-rules: 1/88, nolint: 0/1, autogenerated_exclude: 88/169, exclude: 88/88
INFO [runner] processing took 6.346761ms with stages: identifier_marker: 2.874326ms, autogenerated_exclude: 1.03393ms, path_prettifier: 774.345µs, nolint: 619µs, exclude-rules: 549.199µs, skip_dirs: 448.873µs, cgo: 34.563µs, filename_unadjuster: 7.77µs, max_same_issues: 1.485µs, uniq_by_line: 469ns, exclude: 379ns, skip_files: 356ns, diff: 353ns, max_from_linter: 327ns, source_code: 276ns, max_per_file_from_linter: 258ns, path_shortener: 244ns, sort_results: 231ns, severity-rules: 221ns, path_prefixer: 156ns
INFO [runner] linters took 254.429781ms with stages: goanalysis_metalinter: 247.923216ms
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 22 samples, avg is 62.1MB, max is 135.8MB
INFO Execution took 2.103353669s
My recommendations:
|
Beta Was this translation helpful? Give feedback.
-
Hi, I have a similar problem. I use the container image
The lib contains import (
"context"
"database/sql"
....
"github.com/dedalus-cis4u/dockerutil/v6"
) If I execute the golangci-lint locally it works fine. markus@markus-pc:~/workspace/testutils (master *=)$ make golangci-lint
golangci-lint run --concurrency=24 Unfortunately, it is not possible to share the source code of the project publicly. If there are any questions, I may be able to answer them through individual snippets. |
Beta Was this translation helpful? Give feedback.
-
I'm also seeing this issue:
I really wouldn't expect any of the linters I have enabled to complain about the go standard library Additionally, even if I update the import path to appease the linter (e.g. Is there a way to know which one of the linters is reporting this Thanks. |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
I have the same issue: "net/url" imported and not used (typecheck) my code doesn't even redefine "url" to possibly confuse linter. Only 2 appearances of "url" in the package are mentioned above |
Beta Was this translation helpful? Give feedback.
-
Welcome
Description of the problem
typecheck linter reports false positive errors on imports for packages which have name different from the module name.
Version of golangci-lint
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
#L31
#L101
Beta Was this translation helpful? Give feedback.
All reactions