2008-09-12 23:03:16 +00: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 21:09:16 +00:00
|
|
|
import (
|
2009-12-15 23:29:53 +00:00
|
|
|
"./file"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
2009-03-18 21:09:16 +00:00
|
|
|
)
|
2008-09-12 23:03:16 +00:00
|
|
|
|
|
|
|
func main() {
|
2010-02-26 04:06:41 +00:00
|
|
|
hello := []byte("hello, world\n")
|
2009-12-15 23:29:53 +00:00
|
|
|
file.Stdout.Write(hello)
|
2011-04-18 17:51:40 +00:00
|
|
|
f, err := file.Open("/does/not/exist")
|
2010-12-09 21:18:31 +00:00
|
|
|
if f == nil {
|
2011-07-09 10:16:45 +00:00
|
|
|
fmt.Printf("can't open file; err=%s\n", err.String())
|
2009-12-15 23:29:53 +00:00
|
|
|
os.Exit(1)
|
2008-09-12 23:03:16 +00:00
|
|
|
}
|
|
|
|
}
|