9fans.net/go@v0.0.5/plan9/client/cat/cat.go (about)

     1  // +build ignore
     2  
     3  package main
     4  
     5  import (
     6  	"fmt"
     7  	"io"
     8  	"os"
     9  
    10  	"9fans.net/go/plan9"
    11  	"9fans.net/go/plan9/client"
    12  )
    13  
    14  func main() {
    15  	fsys, err := client.MountService("acme")
    16  	if err != nil {
    17  		panic(err)
    18  	}
    19  
    20  	fid, err := fsys.Open("index", plan9.OREAD)
    21  	if err != nil {
    22  		panic(err)
    23  	}
    24  
    25  	fid.Write([]byte("hello, world"))
    26  
    27  	io.Copy(os.Stdout, fid)
    28  	fid.Close()
    29  
    30  	d, err := fsys.Stat("/index")
    31  	if err != nil {
    32  		panic(err)
    33  	}
    34  	fmt.Printf("%v\n", d)
    35  
    36  	fsys.Wstat("/index", d)
    37  }