Skip to content

use Go 1.21's binary.NativeEndian#220

Merged
mdlayher merged 1 commit intomdlayher:mainfrom
bradfitz:bradfitz/endian
Jan 13, 2025
Merged

use Go 1.21's binary.NativeEndian#220
mdlayher merged 1 commit intomdlayher:mainfrom
bradfitz:bradfitz/endian

Conversation

@bradfitz
Copy link
Copy Markdown
Contributor

No description provided.

bradfitz added a commit to tailscale/tailscale that referenced this pull request Jan 13, 2025
We still use josharian/native (hi @josharian!) via
netlink, but I also sent mdlayher/netlink#220

Updates #8632

Change-Id: I2eedcb7facb36ec894aee7f152c8a1f56d7fc8ba
Signed-off-by: Brad Fitzpatrick <[email protected]>
bradfitz added a commit to tailscale/tailscale that referenced this pull request Jan 13, 2025
We still use josharian/native (hi @josharian!) via
netlink, but I also sent mdlayher/netlink#220

Updates #8632

Change-Id: I2eedcb7facb36ec894aee7f152c8a1f56d7fc8ba
Signed-off-by: Brad Fitzpatrick <[email protected]>
Copy link
Copy Markdown
Owner

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Signed-off-by: Brad Fitzpatrick <[email protected]>
@bradfitz
Copy link
Copy Markdown
Contributor Author

Fixed the CI failure (I hope)... there were two 1.18 references I'd missed.

bradfitz added a commit to tailscale/tailscale that referenced this pull request Jan 13, 2025
We still use josharian/native (hi @josharian!) via
netlink, but I also sent mdlayher/netlink#220

Updates #8632

Change-Id: I2eedcb7facb36ec894aee7f152c8a1f56d7fc8ba
Signed-off-by: Brad Fitzpatrick <[email protected]>
@mdlayher
Copy link
Copy Markdown
Owner

No worries. Clearly I haven't had to touch things much here in a while!

@mdlayher mdlayher merged commit fbb4dce into mdlayher:main Jan 13, 2025
thirdeyenick pushed a commit to ninech/tailscale that referenced this pull request Jul 2, 2025
We still use josharian/native (hi @josharian!) via
netlink, but I also sent mdlayher/netlink#220

Updates tailscale#8632

Change-Id: I2eedcb7facb36ec894aee7f152c8a1f56d7fc8ba
Signed-off-by: Brad Fitzpatrick <[email protected]>
SuperQ added a commit to SuperQ/netlink that referenced this pull request Aug 25, 2025
- [Improvement]: Updated dependencies, test with Go 1.23 to 1.25.
- [Improvement]: Use Go 1.21's binary.NativeEndian (mdlayher#220)
- [Improvement]: Expose socket ReadBuffer & WriteBuffer functions (mdlayher#223)

Signed-off-by: SuperQ <[email protected]>
@SuperQ SuperQ mentioned this pull request Aug 25, 2025
mdlayher pushed a commit that referenced this pull request Aug 25, 2025
- [Improvement]: Updated dependencies, test with Go 1.23 to 1.25.
- [Improvement]: Use Go 1.21's binary.NativeEndian (#220)
- [Improvement]: Expose socket ReadBuffer & WriteBuffer functions (#223)

Signed-off-by: SuperQ <[email protected]>

func skipBigEndian(t *testing.T) {
if binary.ByteOrder(native.Endian) == binary.BigEndian {
if binary.ByteOrder(binary.NativeEndian) == binary.BigEndian {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work as intended.
cf.

	if binary.ByteOrder(binary.NativeEndian) == binary.BigEndian {
		fmt.Println("Arch is big-endian")
	} else if binary.ByteOrder(binary.NativeEndian) == binary.LittleEndian {
		fmt.Println("Arch is little-endian")
	} else {
		fmt.Println("Endianness unknown")
	}

Output:

Endianness unknown

@dswarbrick
Copy link
Copy Markdown
Contributor

I'm not sure yet why, but this PR also caused a regression in bigendian tests on github.com/jsimonetti/rtnetlink that were previously working with github.com/mdlayer/netlink v1.7.2

@dswarbrick
Copy link
Copy Markdown
Contributor

Ok, found it. github.com/jsimonetti/rtnetlink also has a test helper to skip test on bigendian, and it relies on nlenc.NativeEndian() from this package, which was changed by this PR.

jsimonetti/rtnetlink/address_test.go:

func skipBigEndian(t *testing.T) {      
        if nlenc.NativeEndian() == binary.BigEndian {
                t.Skip("skipping test on big-endian system")
        }                       
}

So that fails for the same reason as I outlined in #227 (comment)

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.

3 participants