mirror of
https://github.com/golang/go.git
synced 2026-02-01 16:42:04 +03:00
internal/buildcfg: set Error instead of panicking
All build environment validation sets Error except for the GOEXPERIMENT parser, which panics. Change it to also set Error so that a bad GOEXPERIMENT doesn't cause everything that imports internal/buildcfg to panic on init. Change-Id: Ie9a506ef0978ecb410f2dcd784638f2167354175 Reviewed-on: https://go-review.googlesource.com/c/go/+/310970 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
@@ -108,10 +108,10 @@ func parseExperiments() goexperiment.Flags {
|
||||
}
|
||||
// Check regabi dependencies.
|
||||
if flags.RegabiG && !flags.RegabiWrappers {
|
||||
panic("GOEXPERIMENT regabig requires regabiwrappers")
|
||||
Error = fmt.Errorf("GOEXPERIMENT regabig requires regabiwrappers")
|
||||
}
|
||||
if flags.RegabiArgs && !(flags.RegabiWrappers && flags.RegabiG && flags.RegabiReflect && flags.RegabiDefer) {
|
||||
panic("GOEXPERIMENT regabiargs requires regabiwrappers,regabig,regabireflect,regabidefer")
|
||||
Error = fmt.Errorf("GOEXPERIMENT regabiargs requires regabiwrappers,regabig,regabireflect,regabidefer")
|
||||
}
|
||||
return flags
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user