github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/gojs/testdata/writefs/stat_js.go (about)

     1  package writefs
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"syscall"
     7  )
     8  
     9  func statFields(path string) (atimeNsec, mtimeNsec int64, dev, inode uint64) {
    10  	if t, err := os.Stat(path); err != nil {
    11  		panic(fmt.Errorf("failed to stat path %s: %v", path, err))
    12  	} else {
    13  		d := t.Sys().(*syscall.Stat_t)
    14  		return d.Atime*1e9 + d.AtimeNsec, d.Mtime*1e9 + d.MtimeNsec, uint64(d.Dev), uint64(d.Ino)
    15  	}
    16  }