We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug toml.Unmarshal overrides origin values even if not export field
To Reproduce
package main import ( "fmt" "log" "github.com/pelletier/go-toml" ) type Ti interface { Print() } type tii struct { A string } func (this *tii) Print() { fmt.Print(this.A) } type S struct { A string ti Ti tp *tii } func main() { ti := new(tii) tp := new(tii) s := &S{A: "asd", ti: ti, tp: tp} b, err := toml.Marshal(s) if err != nil { log.Fatalln(err) } fmt.Printf("%p %p %p \n", &s.A, s.ti, s.tp) toml.Unmarshal(b, s) fmt.Printf("%p %p %p \n", &s.A, s.ti, s.tp) ti.Print() tp.Print() s.ti.Print() s.tp.Print() }
print
0xc0000884e0 0xc00005e4c0 0xc00005e4d0 0xc0000884e0 %!p(<nil>) 0x0 panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x18 pc=0x4eea54] goroutine 1 [running]: main.main() E:/Project/toml bug/toml.go:41 +0x4a4 exit status 2
Expected behavior not set nil
Versions
The text was updated successfully, but these errors were encountered:
Thanks for the bug report! Looks like #284 will fix that problem as soon as it's merged (it does work for this specific example).
Sorry, something went wrong.
@For-ACGN #284 has been merged. Do you mind giving this another shot to make sure the bug is fixed for you?
@pelletier @roberth-k Oh! It fix this bug and works right. Thank you! https://github.com/For-ACGN/go-toml-test
No branches or pull requests
Describe the bug
toml.Unmarshal overrides origin values even if not export field
To Reproduce
print
Expected behavior
not set nil
Versions
The text was updated successfully, but these errors were encountered: