1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:50:06 -07:00

go/build: in TestImportDirTarget, only expect an install target when cgo is enabled

As of CL 448803, packages in GOROOT only have install targets when
they have cgo source files. When cgo is not enabled, that condition
is necessarily false, and no install target will exist.

For #47257.

Change-Id: I653a9c5f89d18a5841810f3de8d490bd7cb7e922
Reviewed-on: https://go-review.googlesource.com/c/go/+/449375
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
This commit is contained in:
Bryan C. Mills 2022-11-10 09:44:39 -05:00 committed by Gopher Robot
parent d33043d37d
commit b820fb8df1

View File

@ -681,8 +681,11 @@ func TestImportDirTarget(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if p.PkgTargetRoot == "" || p.PkgObj == "" {
t.Errorf("p.PkgTargetRoot == %q, p.PkgObj == %q, want non-empty", p.PkgTargetRoot, p.PkgObj)
if p.PkgTargetRoot == "" {
t.Errorf("p.PkgTargetRoot == %q, want non-empty", p.PkgTargetRoot)
}
if testenv.HasCGO() && p.PkgObj == "" {
t.Errorf("p.PkgObj == %q, want non-empty", p.PkgObj)
}
}