Skip to content

Commit 3fb2152

Browse files
committed
ST1019: don't flag duplicate imports of unsafe
1 parent 2bb4c4c commit 3fb2152

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

stylecheck/st1019/st1019.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ func run(pass *analysis.Pass) (any, error) {
6767
}
6868

6969
for path, value := range imports {
70+
if path[1:len(path)-1] == "unsafe" {
71+
// Don't flag unsafe. Cgo generated code imports
72+
// unsafe as _cgo_unsafe, in addition to the user's import.
73+
continue
74+
}
7075
// If there's more than one import per path, we flag that
7176
if len(value) > 1 {
7277
s := fmt.Sprintf("package %s is being imported more than once", path)

0 commit comments

Comments
 (0)