1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:14:41 -07:00

gob: don't add "." if package path is empty when registering a type.

R=rsc
CC=golang-dev
https://golang.org/cl/2939041
This commit is contained in:
Rob Pike 2010-11-05 11:22:28 -07:00
parent 40d10a34db
commit c9d39dca8d

View File

@ -495,8 +495,12 @@ func Register(value interface{}) {
} }
} }
if rt.Name() != "" { if rt.Name() != "" {
if rt.PkgPath() == "" {
name = star + rt.Name()
} else {
name = star + rt.PkgPath() + "." + rt.Name() name = star + rt.PkgPath() + "." + rt.Name()
} }
}
RegisterName(name, value) RegisterName(name, value)
} }