github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/compiler/natives/src/os/os.go (about)

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