Debian Codegraph @

imports/wasi_snapshot_preview1/example/testdata/tinygo/cat.go

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