-
Notifications
You must be signed in to change notification settings - Fork 18k
reflect: gccgo+gotip1.6beta1 crashes on multi-line field tags #43379
New issue
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
Comments
Closing as a dup of #42916. I don't think this has anything to do with multi-line field tags as such. |
So the workable multi-line field tag workaround is unintended, but they will be kept as such for compatibility? |
Maybe I'm misunderstanding. Are you saying that if you add or remove a multi-line field tag it changes the behavior on tip? |
I just asked to confirm whether or not the key-value pair |
The docs for struct tags say that the value string should use Go string literal syntax, so I think that putting a bare newline in a value string does not follow the documentation. |
I understand this. So I'm not surprised that the field What is the principle difference to make the field package main
import "fmt"
import "reflect"
type T struct {
Z int `optional:"111" name:"22
2" default:"333"`
W int `optional:"111"
name:"222" default:"333"`
}
func main() {
t := reflect.TypeOf(T{})
z := t.Field(0).Tag
fmt.Println(z.Lookup("optional")) // 111 true
fmt.Println(z.Lookup("name")) // false
fmt.Println(z.Lookup("default")) // 333 true
w := t.Field(1).Tag
fmt.Println(w.Lookup("optional")) // 111 true
fmt.Println(w.Lookup("name")) // false
fmt.Println(w.Lookup("default")) // false
} |
The |
Thanks for confirming this is a unspecified behavior. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No.
What did you do?
What did you expect to see?
gccgo will not crash in compiling.
And should
z.Lookup("default")
return"" false
instead?What did you see instead?
The text was updated successfully, but these errors were encountered: