1
0
mirror of https://github.com/golang/go synced 2024-11-21 15:34:45 -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,7 +495,11 @@ func Register(value interface{}) {
}
}
if rt.Name() != "" {
name = star + rt.PkgPath() + "." + rt.Name()
if rt.PkgPath() == "" {
name = star + rt.Name()
} else {
name = star + rt.PkgPath() + "." + rt.Name()
}
}
RegisterName(name, value)