Skip to content

Commit 4d17acb

Browse files
matloobandybons
authored andcommitted
[release-branch.go1.11] go/packages: fix build breakage caused by math/bits to unsafe dep
Our tests compare import graphs from go/packages to expected graphs, and one of the test cases imports math/bits. But in tip math/bits picked up a dependency on unsafe, which means the expected graph is different when run against a Go version >= go1.11. Remove that edge before comparing against the expected graph to work around the breakage. Change-Id: Ic586a75ba530741d251df9f87d0817a8e37d92ea Reviewed-on: https://go-review.googlesource.com/c/151657 Run-TryBot: Michael Matloob <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Cottrell <[email protected]> (cherry picked from commit c5b00d9) Reviewed-on: https://go-review.googlesource.com/c/153864 Run-TryBot: Andrew Bonventre <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent 64f9b8a commit 4d17acb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

go/packages/packages_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,12 @@ func importGraph(initial []*packages.Package) (string, map[string]*packages.Pack
13211321
continue
13221322
}
13231323
}
1324+
// math/bits took on a dependency on unsafe in 1.12, which breaks some
1325+
// tests. As a short term hack, prune that edge.
1326+
// TODO(matloob): think of a cleaner solution, or remove math/bits from the test.
1327+
if p.ID == "math/bits" && imp.ID == "unsafe" {
1328+
continue
1329+
}
13241330
edges = append(edges, fmt.Sprintf("%s -> %s", p, imp))
13251331
visit(imp)
13261332
}

0 commit comments

Comments
 (0)