cmd/compile,cmd/internal/objabi: abstract out object header string

Change-Id: Idbbb4cb7127b93afa34a8aa18bbdaad1f206ab6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/308090
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Austin Clements 2021-04-07 09:27:11 -04:00
parent b675e52e95
commit 89ca1ce9a8
3 changed files with 13 additions and 4 deletions

View file

@ -243,9 +243,9 @@ func importfile(decl *syntax.ImportDecl) *types.Pkg {
base.Errorf("import %s: not a go object file: %s", file, p)
base.ErrorExit()
}
q := fmt.Sprintf("%s %s %s %s\n", objabi.GOOS, objabi.GOARCH, objabi.Version, objabi.Expstring())
if p[10:] != q {
base.Errorf("import %s: object is [%s] expected [%s]", file, p[10:], q)
q := objabi.HeaderString()
if p != q {
base.Errorf("import %s: object is [%s] expected [%s]", file, p, q)
base.ErrorExit()
}