A nil *gcSizes pointer should be converted to a nil Sizes interface.
Updates #63701
Change-Id: I62e00fecf303ce0ae529f1a75c14c7ef2576a58f
Reviewed-on: https://go-review.googlesource.com/c/go/+/537255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
}
// gcSizesFor returns the Sizes used by gc for an architecture.
-// The result is nil if a compiler/architecture pair is not known.
+// The result is a nil *gcSizes pointer (which is not a valid types.Sizes)
+// if a compiler/architecture pair is not known.
func gcSizesFor(compiler, arch string) *gcSizes {
if compiler != "gc" {
return nil
func SizesFor(compiler, arch string) Sizes {
switch compiler {
case "gc":
- return gcSizesFor(compiler, arch)
+ if s := gcSizesFor(compiler, arch); s != nil {
+ return Sizes(s)
+ }
case "gccgo":
if s, ok := gccgoArchSizes[arch]; ok {
- return s
+ return Sizes(s)
}
}
return nil
}
// gcSizesFor returns the Sizes used by gc for an architecture.
-// The result is nil if a compiler/architecture pair is not known.
+// The result is a nil *gcSizes pointer (which is not a valid types.Sizes)
+// if a compiler/architecture pair is not known.
func gcSizesFor(compiler, arch string) *gcSizes {
if compiler != "gc" {
return nil
func SizesFor(compiler, arch string) Sizes {
switch compiler {
case "gc":
- return gcSizesFor(compiler, arch)
+ if s := gcSizesFor(compiler, arch); s != nil {
+ return Sizes(s)
+ }
case "gccgo":
if s, ok := gccgoArchSizes[arch]; ok {
- return s
+ return Sizes(s)
}
}
return nil