cmd/compile: treat empty and absent struct field tags as identical
Fixes #15439.
Change-Id: I5a32384c46e20f8db6968e5a9e854c45ab262fe4
Reviewed-on: https://go-review.googlesource.com/22429
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/compile/internal/gc/bexport.go b/src/cmd/compile/internal/gc/bexport.go
index bf1354c..c635129 100644
--- a/src/cmd/compile/internal/gc/bexport.go
+++ b/src/cmd/compile/internal/gc/bexport.go
@@ -720,18 +720,7 @@
p.pos(f.Sym.Def)
p.fieldName(f.Sym, f)
p.typ(f.Type)
- // TODO(gri) Do we care that a non-present tag cannot be distinguished
- // from a present but empty ta string? (reflect doesn't seem to make
- // a difference). Investigate.
- p.note(f.Note)
-}
-
-func (p *exporter) note(n *string) {
- var s string
- if n != nil {
- s = *n
- }
- p.string(s)
+ p.string(f.Note)
}
func (p *exporter) methodList(t *Type) {
@@ -847,7 +836,7 @@
// TODO(gri) This is compiler-specific (escape info).
// Move into compiler-specific section eventually?
// (Not having escape info causes tests to fail, e.g. runtime GCInfoTest)
- p.note(q.Note)
+ p.string(q.Note)
}
func parName(f *Field, numbered bool) string {