Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-linux build #625

Merged
merged 1 commit into from
Mar 16, 2021
Merged

Fix non-linux build #625

merged 1 commit into from
Mar 16, 2021

Conversation

joestringer
Copy link
Contributor

@joestringer joestringer commented Mar 15, 2021

Commit ec93726 ("Adds strings translation methods") broke non-Linux
builds by relying on unix constants that are only declared on the linux
platform in the upstream x/sys/unix package.

Other platforms report undefined variables, such as the following:

  $ GOOS=darwin go build .
  # github.com/vishvananda/netlink
  ./route.go:17:7: undefined: SCOPE_UNIVERSE
  ./route.go:19:7: undefined: SCOPE_SITE
  ./route.go:21:7: undefined: SCOPE_LINK
  ./route.go:23:7: undefined: SCOPE_HOST
  ./route.go:25:7: undefined: SCOPE_NOWHERE
  ./route.go:55:7: undefined: unix.RTPROT_BABEL
  ./route.go:57:7: undefined: unix.RTPROT_BGP
  ./route.go:59:7: undefined: unix.RTPROT_BIRD
  ./route.go:61:7: undefined: unix.RTPROT_BOOT
  ./route.go:63:7: undefined: unix.RTPROT_DHCP
  ./route.go:63:7: too many errors

Move the platform-specific implementations to platform-specific files
and add stubs to satisfy other platforms.

Fixes: ec93726 ("Adds strings translation methods")

CC @riccardomanfrin @aboch

Commit ec93726 ("Adds strings translation methods") broke non-Linux
builds by relying on unix constants that are only declared on the linux
platform in the upstream x/sys/unix package.

Other platforms report undefined variables, such as the following:

  $ GOOS=darwin go build .
  # github.com/vishvananda/netlink
  ./route.go:17:7: undefined: SCOPE_UNIVERSE
  ./route.go:19:7: undefined: SCOPE_SITE
  ./route.go:21:7: undefined: SCOPE_LINK
  ./route.go:23:7: undefined: SCOPE_HOST
  ./route.go:25:7: undefined: SCOPE_NOWHERE
  ./route.go:55:7: undefined: unix.RTPROT_BABEL
  ./route.go:57:7: undefined: unix.RTPROT_BGP
  ./route.go:59:7: undefined: unix.RTPROT_BIRD
  ./route.go:61:7: undefined: unix.RTPROT_BOOT
  ./route.go:63:7: undefined: unix.RTPROT_DHCP
  ./route.go:63:7: too many errors

Move the platform-specific implementations to platform-specific files
and add stubs to satisfy other platforms.

Fixes: ec93726 ("Adds strings translation methods")
Signed-off-by: Joe Stringer <joe@cilium.io>
@riccardomanfrin
Copy link
Contributor

Thank you @joestringer

@aboch
Copy link
Collaborator

aboch commented Mar 16, 2021

LGTM

@aboch aboch merged commit c21bda4 into vishvananda:master Mar 16, 2021
@joestringer joestringer deleted the fix-build branch March 16, 2021 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants