mirror of
https://github.com/golang/go
synced 2024-11-26 06:38:00 -07: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:
parent
da7496d841
commit
e15d1f4e64
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user