1
0
mirror of https://github.com/golang/go synced 2024-11-18 13:54:59 -07:00
This commit is contained in:
Jes Cok 2023-09-13 06:37:51 +08:00
parent 633026453c
commit 6cd811b186

View File

@ -260,10 +260,9 @@ func (d *parseDoc) lookupPkg(pkg string) (importPath string, ok bool) {
}
func isStdPkg(path string) bool {
_, ok := sort.Find(len(stdPkgs), func(i int) int {
return strings.Compare(path, stdPkgs[i])
})
return ok
// TODO: Use slices.BinarySearch when possible.
i := sort.Search(len(stdPkgs), func(i int) bool { return stdPkgs[i] >= path })
return i < len(stdPkgs) && stdPkgs[i] == path
}
// DefaultLookupPackage is the default package lookup