|
Johann Höchtl |
at Sep 20, 2012 at 7:22 pm
|
⇧ |
| |
Am Donnerstag, 20. September 2012 00:15:34 UTC+2 schrieb Jai Kumar:
Thanks. Got it. I checked error and it was permission issue. Thank you. I
fixed it now. You guys are awesome :)
Thanks god it was a permission issue, otherwise you would be executing as
root which is generally a bad idea.
On Wednesday, September 19, 2012 3:11:27 PM UTC-7, Dave Cheney wrote:You are discarding the error value returned form ioutil.TempFile. If
there is an error (and there is good reason to believe there is) then
you cannot make any assumptions about the value of tempFile.
Cheers
Dave
On Thu, Sep 20, 2012 at 8:07 AM, Jai Kumar wrote:Why I am unable to create a temp file? Please see my code below.
You can refer here
http://play.golang.org/p/oI4IiXLRfror you can view code below.
(both are same)
package main
import "fmt"
import "io/ioutil"
func main() {
tempFile, _ := ioutil.TempFile("/", "postcard_vid")
fmt.Println(tempFile.Name())
}
throws error:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x8 pc=0x400c77]
goroutine 1 [running]:
main.main()
/tmpfs/gosandbox-0656bfdd_990cb295_da1c8f79_6e849913_24d9a636/prog.go:8
+0x77
--
--