aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gostaticanalysis/analysisutil/pkg.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-01-22 16:07:17 +0100
committerTaras Madan <tarasmadan@google.com>2025-01-23 10:42:36 +0000
commit7b4377ad9d8a7205416df8d6217ef2b010f89481 (patch)
treee6fec4fd12ff807a16d847923f501075bf71d16c /vendor/github.com/gostaticanalysis/analysisutil/pkg.go
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/gostaticanalysis/analysisutil/pkg.go')
-rw-r--r--vendor/github.com/gostaticanalysis/analysisutil/pkg.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/vendor/github.com/gostaticanalysis/analysisutil/pkg.go b/vendor/github.com/gostaticanalysis/analysisutil/pkg.go
deleted file mode 100644
index b64150d81..000000000
--- a/vendor/github.com/gostaticanalysis/analysisutil/pkg.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package analysisutil
-
-import (
- "go/types"
- "strconv"
- "strings"
-
- "golang.org/x/tools/go/analysis"
-)
-
-// RemoVendor removes vendoring information from import path.
-func RemoveVendor(path string) string {
- i := strings.Index(path, "vendor/")
- if i >= 0 {
- return path[i+len("vendor/"):]
- }
- return path
-}
-
-// LookupFromImports finds an object from import paths.
-func LookupFromImports(imports []*types.Package, path, name string) types.Object {
- path = RemoveVendor(path)
- for i := range imports {
- if path == RemoveVendor(imports[i].Path()) {
- return imports[i].Scope().Lookup(name)
- }
- }
- return nil
-}
-
-// Imported returns true when the given pass imports the pkg.
-func Imported(pkgPath string, pass *analysis.Pass) bool {
- fs := pass.Files
- if len(fs) == 0 {
- return false
- }
- for _, f := range fs {
- for _, i := range f.Imports {
- path, err := strconv.Unquote(i.Path.Value)
- if err != nil {
- continue
- }
- if RemoveVendor(path) == pkgPath {
- return true
- }
- }
- }
- return false
-}