]> Cypherpunks repositories - gostls13.git/commitdiff
go/build: in TestImportDirTarget, only expect an install target when cgo is enabled
authorBryan C. Mills <bcmills@google.com>
Thu, 10 Nov 2022 14:44:39 +0000 (09:44 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 10 Nov 2022 17:06:47 +0000 (17:06 +0000)
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>

src/go/build/build_test.go

index db50d45d84eccb81ef6b5a3203cced5283638d30..3eebfd8e9eb867baafcd9aa84744f7ba2917fc40 100644 (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)
        }
 }