Registry / utility / josharian-native

josharian-native

JSON →
library1.1.0gogounverified

Provides easy access to the native byte order of the current system, with a warning about portability.

go get github.com/josharian/native
INSTALL
IMPORT
SIG · JOSHARIAN-NATIVE
J
josharian-native
utilitygov1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

native
github.com/josharian/native

Writes a uint32 in native byte order.

package main import ( "encoding/binary" "fmt" "github.com/josharian/native" ) func main() { var val uint32 = 0x01020304 buf := make([]byte, 4) native.Endian.PutUint32(buf, val) fmt.Printf("%x\n", buf) }
Debug
Known issues
gotchaUsing native byte order can break program portability across different architectures.
fix
Consider using a fixed byte order (e.g., binary.BigEndian) for network or file formats.
affects: >=1.0.0
Upgrade
Version history
1.1.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
josharian-native — go get josharian-native · libregistry