From 3dac99ad4cdc7014343bcbddf01aca2d9e7a4e96 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 23 Mar 2022 12:22:50 -0700 Subject: 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 Run-TryBot: Matthew Dempsky TryBot-Result: Gopher Robot Reviewed-by: Cherry Mui --- src/cmd/compile/internal/noder/import.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/cmd/compile/internal/noder') 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 } -- cgit v1.3