You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1.
// http://play.golang.org/p/-si45rJB7C
package main
import (
"encoding/xml"
"bytes"
)
func main() {
var buffy *bytes.Buffer
xml.Escape(buffy, []byte("foo"))
}
2. Save as test.go
3. go run test.go
What is the expected output?
An intelligible error message informing me that my variable is uninitialized
What do you see instead?
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x58 pc=0x415fa8]
goroutine 1 [running]:
bytes.(*Buffer).Write(0x0, 0xf84005b000, 0x300000003, 0x200000000, 0x0, ...)
go/src/pkg/bytes/buffer.go:107 +0x30
encoding/xml.Escape(0xf840024570, 0x0, 0xf84005b000, 0x300000003, 0x0, ...)
go/src/pkg/encoding/xml/xml.go:1673 +0x1a9
main.main()
/tmpfs/gosandbox-1ed22190_28b8d3ce_26e32609_9c0c9a0b_60e64093/prog.go:10 +0xa1
Which compiler are you using (5g, 6g, 8g, gccgo)?
Which operating system are you using?
Which version are you using? (run 'go version')
Please provide any additional information below.
The text was updated successfully, but these errors were encountered:
by mux2005:
The text was updated successfully, but these errors were encountered: