Source file doc/progs/helloworld3.go
1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "./file" 9 "fmt" 10 "os" 11 ) 12 13 func main() { 14 hello := []byte("hello, world\n") 15 file.Stdout.Write(hello) 16 f, err := file.Open("/does/not/exist") 17 if f == nil { 18 fmt.Printf("can't open file; err=%s\n", err.String()) 19 os.Exit(1) 20 } 21 }