mirror of
https://github.com/golang/go
synced 2024-11-21 23:04:39 -07:00
internal/pkgbits: s/errorf/panicf/ because that's what it is
Make it obvious that this function panics. Change-Id: I272142d2cf7132aa8915f8f4b5945834376db062 Reviewed-on: https://go-review.googlesource.com/c/go/+/606935 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
2e0a6f855b
commit
7fcd4a7007
@ -84,7 +84,7 @@ func NewPkgDecoder(pkgPath, input string) PkgDecoder {
|
||||
|
||||
switch pr.version {
|
||||
default:
|
||||
panic(fmt.Errorf("unsupported version: %v", pr.version))
|
||||
panicf("unsupported version: %v", pr.version)
|
||||
case 0:
|
||||
// no flags
|
||||
case 1:
|
||||
@ -136,7 +136,7 @@ func (pr *PkgDecoder) AbsIdx(k RelocKind, idx Index) int {
|
||||
absIdx += int(pr.elemEndsEnds[k-1])
|
||||
}
|
||||
if absIdx >= int(pr.elemEndsEnds[k]) {
|
||||
errorf("%v:%v is out of bounds; %v", k, idx, pr.elemEndsEnds)
|
||||
panicf("%v:%v is out of bounds; %v", k, idx, pr.elemEndsEnds)
|
||||
}
|
||||
return absIdx
|
||||
}
|
||||
@ -242,7 +242,7 @@ type Decoder struct {
|
||||
|
||||
func (r *Decoder) checkErr(err error) {
|
||||
if err != nil {
|
||||
errorf("unexpected decoding error: %w", err)
|
||||
panicf("unexpected decoding error: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ func (w *Encoder) Flush() Index {
|
||||
|
||||
func (w *Encoder) checkErr(err error) {
|
||||
if err != nil {
|
||||
errorf("unexpected encoding error: %v", err)
|
||||
panicf("unexpected encoding error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,7 +359,7 @@ func (w *Encoder) Value(val constant.Value) {
|
||||
func (w *Encoder) scalar(val constant.Value) {
|
||||
switch v := constant.Val(val).(type) {
|
||||
default:
|
||||
errorf("unhandled %v (%v)", val, val.Kind())
|
||||
panicf("unhandled %v (%v)", val, val.Kind())
|
||||
case bool:
|
||||
w.Code(ValBool)
|
||||
w.Bool(v)
|
||||
|
@ -12,6 +12,6 @@ func assert(b bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func errorf(format string, args ...any) {
|
||||
func panicf(format string, args ...any) {
|
||||
panic(fmt.Errorf(format, args...))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user