2008-09-12 17:03:16 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
2009-03-18 15:09:16 -06:00
|
|
|
import (
|
2009-12-15 16:29:53 -07:00
|
|
|
"./file"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
2009-03-18 15:09:16 -06:00
|
|
|
)
|
2008-09-12 17:03:16 -06:00
|
|
|
|
|
|
|
func main() {
|
2010-02-25 21:06:41 -07:00
|
|
|
hello := []byte("hello, world\n")
|
2009-12-15 16:29:53 -07:00
|
|
|
file.Stdout.Write(hello)
|
2011-04-18 11:51:40 -06:00
|
|
|
f, err := file.Open("/does/not/exist")
|
2010-12-09 14:18:31 -07:00
|
|
|
if f == nil {
|
2011-11-01 20:06:05 -06:00
|
|
|
fmt.Printf("can't open file; err=%s\n", err.Error())
|
2009-12-15 16:29:53 -07:00
|
|
|
os.Exit(1)
|
2008-09-12 17:03:16 -06:00
|
|
|
}
|
|
|
|
}
|