github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/experimental/gojs/example/cat/main.go (about)

     1  package main
     2  
     3  import (
     4  	"os"
     5  )
     6  
     7  // main runs cat: concatenate and print files.
     8  func main() {
     9  	// Start at arg[1] because args[0] is the program name.
    10  	for i := 1; i < len(os.Args); i++ {
    11  		bytes, err := os.ReadFile(os.Args[i])
    12  		if err != nil {
    13  			os.Exit(1)
    14  		}
    15  
    16  		// Use write to avoid needing to worry about Windows newlines.
    17  		os.Stdout.Write(bytes)
    18  	}
    19  }