Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit ef35939

Browse files
glynChris Brown
authored and
Chris Brown
committed
Build netdog
Previously netdog had to be built with Go 1.3 to ensure it was statically linked. With a workaround to Go bug 9344[1], this is now achievable with Go 1.4. [1]: golang/go#9344 [#86913170] Signed-off-by: Chris Brown <[email protected]>
1 parent d180354 commit ef35939

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

integration/networking/netdog/netdog

-2.77 MB
Binary file not shown.

integration/networking/networking_suite_test.go

+11-6
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,17 @@ func TestNetworking(t *testing.T) {
7272
beforeSuite.GardenPath, err = gexec.Build("github.com/cloudfoundry-incubator/garden-linux", "-a", "-race", "-tags", "daemon")
7373
Ω(err).ShouldNot(HaveOccurred())
7474

75-
// FIXME: netdog cannot be statically linked with Go 1.4, so use a checked-in version built with Go 1.3.1 for now.
76-
// See https://groups.google.com/forum/#!msg/golang-nuts/S2WDcm47bhA/W243-l49WDsJ
77-
// os.Setenv("CGO_ENABLED", "0")
78-
// beforeSuite.NetdogPath, err = gexec.Build("github.com/cloudfoundry-incubator/garden-linux/integration/networking/netdog", "-a")
79-
// Ω(err).ShouldNot(HaveOccurred())
80-
beforeSuite.NetdogPath = "../../integration/networking/netdog/netdog"
75+
oldCgo := os.Getenv("CGO_ENABLED")
76+
77+
os.Setenv("CGO_ENABLED", "0")
78+
beforeSuite.NetdogPath, err = gexec.Build("github.com/cloudfoundry-incubator/garden-linux/integration/networking/netdog", "-a", "-installsuffix", "cgo")
79+
Ω(err).ShouldNot(HaveOccurred())
80+
81+
if oldCgo == "" {
82+
os.Unsetenv("CGO_ENABLED")
83+
} else {
84+
os.Setenv("CGO_ENABLED", oldCgo)
85+
}
8186

8287
ips, err := net.LookupIP("www.example.com")
8388
Ω(err).ShouldNot(HaveOccurred())

0 commit comments

Comments
 (0)