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)
|
|
|
|
file, err := file.Open("/does/not/exist", 0, 0)
|
2009-01-09 16:16:31 -07:00
|
|
|
if file == nil {
|
2009-12-15 16:29:53 -07:00
|
|
|
fmt.Printf("can't open file; err=%s\n", err.String())
|
|
|
|
os.Exit(1)
|
2008-09-12 17:03:16 -06:00
|
|
|
}
|
|
|
|
}
|