Debian Codegraph @

gopls/internal/vulncheck/vulntest/stdlib.go

raw symbols SCIP
1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package vulntest
6
7 import (
8 "strings"
9
10 "golang.org/x/mod/module"
11 )
12
13 // maybeStdlib reports whether the given import path could be part of the Go
14 // standard library, by reporting whether the first component lacks a '.'.
15 func maybeStdlib(path string) bool {
16 if err := module.CheckImportPath(path); err != nil {
17 return false
18 }
19 if i := strings.IndexByte(path, '/'); i != -1 {
20 path = path[:i]
21 }
22 return !strings.Contains(path, ".")
23 }