package main
import (
"log"
"os"
)
func main() {
// Create a new logger l for output to stderr.
// If you don't want the log date, change the flag from 1 to 0.
l := log.New(os.Stderr, "", 1)
// Some code to force an error.
file, err := os.Open("file.go") // For read access.
if err != nil {
// Output the error do stderr
l.Println(err)
}
_ = file // just to avoid errors at compile time
}