fork(1) download
  1. package main
  2.  
  3. import (
  4. "os"
  5. "fmt"
  6. "image"
  7. "image/jpeg"
  8. )
  9.  
  10. func main() {
  11. o := jpeg.Options {};
  12. m := image.NewRGBA(image.Rect(0, 0, 100, 100))
  13. fo, _ := os.Create("output.jpg")
  14. defer fo.Close()
  15. jpeg.Encode (fo, m, &o);
  16. fmt.Println(m.Bounds())
  17. fmt.Println(m.At(0, 0).RGBA())
  18. }
  19.  
Runtime error #stdin #stdout #stderr 0s 420288KB
stdin
Standard input is empty
stdout
(0,0)-(100,100)
0 0 0 0
stderr
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x805e1c8]

goroutine 1 [running]:
os.(*File).Close(0x0, 0xa, 0x0)
	/opt/go/src/pkg/os/file_unix.go:99 +0x21
main.main()
	/home/2TWFQC/prog.go:17 +0x2d4

goroutine 2 [syscall]:
created by runtime.main
	/usr/local/go/src/pkg/runtime/proc.c:221