diff --git a/internal/imports/mkstdlib.go b/internal/imports/mkstdlib.go index 43fdddb4ad..fa69eebb7e 100644 --- a/internal/imports/mkstdlib.go +++ b/internal/imports/mkstdlib.go @@ -19,7 +19,6 @@ import ( "regexp" "runtime" "sort" - "strings" ) func mustOpen(name string) io.Reader { @@ -75,10 +74,6 @@ func main() { for sc.Scan() { l := sc.Text() - has := func(v string) bool { return strings.Contains(l, v) } - if has("struct, ") || has("interface, ") || has(", method (") { - continue - } if m := sym.FindStringSubmatch(l); m != nil { path, sym := m[1], m[2] diff --git a/internal/imports/zstdlib.go b/internal/imports/zstdlib.go index 78fac48cb5..544339e53b 100644 --- a/internal/imports/zstdlib.go +++ b/internal/imports/zstdlib.go @@ -2637,10 +2637,12 @@ var stdlib = map[string]map[string]bool{ "CommentMap": true, "CompositeLit": true, "Con": true, + "Decl": true, "DeclStmt": true, "DeferStmt": true, "Ellipsis": true, "EmptyStmt": true, + "Expr": true, "ExprStmt": true, "Field": true, "FieldFilter": true, @@ -2701,7 +2703,9 @@ var stdlib = map[string]map[string]bool{ "SendStmt": true, "SliceExpr": true, "SortImports": true, + "Spec": true, "StarExpr": true, + "Stmt": true, "StructType": true, "SwitchStmt": true, "Typ": true, @@ -2770,6 +2774,7 @@ var stdlib = map[string]map[string]bool{ "UnaryOp": true, "Unknown": true, "Val": true, + "Value": true, }, "go/doc": map[string]bool{ "AllDecls": true, @@ -3019,6 +3024,7 @@ var stdlib = map[string]map[string]bool{ "NewTypeName": true, "NewVar": true, "Nil": true, + "Object": true, "ObjectString": true, "Package": true, "PkgName": true, @@ -4326,6 +4332,7 @@ var stdlib = map[string]map[string]bool{ "StructOf": true, "StructTag": true, "Swapper": true, + "Type": true, "TypeOf": true, "Uint": true, "Uint16": true, @@ -8023,6 +8030,7 @@ var stdlib = map[string]map[string]bool{ "Rmdir": true, "RouteMessage": true, "RouteRIB": true, + "RoutingMessage": true, "RtAttr": true, "RtGenmsg": true, "RtMetrics": true, @@ -9391,6 +9399,7 @@ var stdlib = map[string]map[string]bool{ "SlicePtrFromStrings": true, "SockFilter": true, "SockFprog": true, + "Sockaddr": true, "SockaddrDatalink": true, "SockaddrGen": true, "SockaddrInet4": true, @@ -9863,6 +9872,7 @@ var stdlib = map[string]map[string]bool{ "RunTests": true, "Short": true, "T": true, + "TB": true, "Verbose": true, }, "testing/iotest": map[string]bool{ diff --git a/internal/lsp/testdata/unimported/mkunimported.go b/internal/lsp/testdata/unimported/mkunimported.go index 80915c90b6..d4210b0c38 100644 --- a/internal/lsp/testdata/unimported/mkunimported.go +++ b/internal/lsp/testdata/unimported/mkunimported.go @@ -72,10 +72,6 @@ func main() { paths := []string{"unsafe", "syscall/js"} for sc.Scan() { l := sc.Text() - has := func(v string) bool { return strings.Contains(l, v) } - if has("struct, ") || has("interface, ") || has(", method (") { - continue - } if m := sym.FindStringSubmatch(l); m != nil { path, _ := m[1], m[2]