aboutsummaryrefslogtreecommitdiff
path: root/internal/stdlib/stdlib.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2019-11-11 16:22:26 -0500
committerJulie Qiu <julie@golang.org>2020-03-27 16:46:47 -0400
commit355b026adf25658be4978470eb851cb27eb30a3f (patch)
tree1ad19c5761ed018700382de645017250716165d4 /internal/stdlib/stdlib.go
parent8f7732c9ce43eafff92a3395e86ee9bf0264a1aa (diff)
downloadgo-x-pkgsite-355b026adf25658be4978470eb851cb27eb30a3f.tar.xz
internal/postgres: ignore self-imports in imported-by counts
Do not count package A as importing package B if they are in the same module. Change-Id: Ic0f98af8d72b8fff29e105779c6eb619214335e9 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/596525 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Julie Qiu <julieqiu@google.com>
Diffstat (limited to 'internal/stdlib/stdlib.go')
-rw-r--r--internal/stdlib/stdlib.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/stdlib/stdlib.go b/internal/stdlib/stdlib.go
index 8a081cfc..adf1cf49 100644
--- a/internal/stdlib/stdlib.go
+++ b/internal/stdlib/stdlib.go
@@ -357,6 +357,14 @@ func subTree(r *git.Repository, t *object.Tree, name string) (*object.Tree, erro
return nil, os.ErrNotExist
}
+// Contains reports whether the given import path is part of the Go standard library.
+func Contains(path string) bool {
+ if i := strings.IndexByte(path, '/'); i != -1 {
+ path = path[:i]
+ }
+ return !strings.Contains(path, ".")
+}
+
// References used for Versions during testing.
var testRefs = []plumbing.ReferenceName{
"refs/changes/56/93156/13",