github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/tests/testdata/legacy_syscall/main.go (about) 1 //go:build legacy_syscall && gopherjs 2 // +build legacy_syscall,gopherjs 3 4 // This program tests GopherJS's ability to perform raw syscalls using the 5 // deprecated node_syscall extension. See TestLegacySyscall. 6 package main 7 8 import ( 9 "syscall" 10 "unsafe" 11 ) 12 13 func main() { 14 msg := []byte("Hello, world!\n") 15 _, _, errno := syscall.Syscall(1 /* SYS_WRITE on Linux */, 1 /* stdout */, uintptr(unsafe.Pointer(&msg[0])), uintptr(len(msg))) 16 if errno != 0 { 17 println(errno.Error()) 18 } 19 }