aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/import.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2022-03-23 12:22:50 -0700
committerMatthew Dempsky <mdempsky@google.com>2022-03-25 21:58:03 +0000
commit3dac99ad4cdc7014343bcbddf01aca2d9e7a4e96 (patch)
treed75c5beabef6f1eeb4b88f57af5dec3fefdc3ed8 /src/cmd/compile/internal/noder/import.go
parent3dac914b772f7c99bb749839946ca68878a65f35 (diff)
downloadgo-3dac99ad4cdc7014343bcbddf01aca2d9e7a4e96.tar.xz
cmd/compile: simplify fingerprint logic
Historically, we sometimes recorded imports based on either package path ("net/http") or object file path ("net/http.a"). But modern Go build systems always use package path, and the extra ".a" suffix doesn't mean anything anyway. Change-Id: I6060ef8bafa324168710d152a353f4d8db062133 Reviewed-on: https://go-review.googlesource.com/c/go/+/395254 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/import.go')
-rw-r--r--src/cmd/compile/internal/noder/import.go10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/cmd/compile/internal/noder/import.go b/src/cmd/compile/internal/noder/import.go
index 0898a298eb..7ba1b23d12 100644
--- a/src/cmd/compile/internal/noder/import.go
+++ b/src/cmd/compile/internal/noder/import.go
@@ -369,16 +369,8 @@ func addFingerprint(path string, f *os.File, end int64) error {
}
copy(fingerprint[:], buf[:])
+ base.Ctxt.AddImport(path, fingerprint)
- // assume files move (get installed) so don't record the full path
- if base.Flag.Cfg.PackageFile != nil {
- // If using a packageFile map, assume path_ can be recorded directly.
- base.Ctxt.AddImport(path, fingerprint)
- } else {
- // For file "/Users/foo/go/pkg/darwin_amd64/math.a" record "math.a".
- file := f.Name()
- base.Ctxt.AddImport(file[len(file)-len(path)-len(".a"):], fingerprint)
- }
return nil
}