github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/compiler/natives/src/os/os.go (about) 1 //go:build js 2 // +build js 3 4 package os 5 6 import ( 7 "errors" 8 _ "unsafe" // for go:linkname 9 10 "github.com/gopherjs/gopherjs/js" 11 ) 12 13 const isBigEndian = false 14 15 func runtime_args() []string { // not called on Windows 16 return Args 17 } 18 19 func init() { 20 if process := js.Global.Get("process"); process != js.Undefined { 21 if argv := process.Get("argv"); argv != js.Undefined && argv.Length() >= 1 { 22 Args = make([]string, argv.Length()-1) 23 for i := 0; i < argv.Length()-1; i++ { 24 Args[i] = argv.Index(i + 1).String() 25 } 26 } 27 } 28 if len(Args) == 0 { 29 Args = []string{"?"} 30 } 31 } 32 33 func runtime_beforeExit() {} 34 35 func executable() (string, error) { 36 return "", errors.New("Executable not implemented for GOARCH=js") 37 } 38 39 //go:linkname fastrand runtime.fastrand 40 func fastrand() uint32