Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 31 lines 697 B view raw
1package errors 2 3import ( 4 "fmt" 5 6 objectid "codeberg.org/lindenii/furgit/object/id" 7 objecttype "codeberg.org/lindenii/furgit/object/type" 8) 9 10// ObjectTypeError indicates that a referenced object has a different type than 11// what the operation expected. 12type ObjectTypeError struct { 13 OID objectid.ObjectID 14 Got objecttype.Type 15 Want objecttype.Type 16} 17 18// Error implements error. 19func (e *ObjectTypeError) Error() string { 20 gotName, gotOK := e.Got.Name() 21 if !gotOK { 22 gotName = fmt.Sprintf("type(%d)", e.Got) 23 } 24 25 wantName, wantOK := e.Want.Name() 26 if !wantOK { 27 wantName = fmt.Sprintf("type(%d)", e.Want) 28 } 29 30 return fmt.Sprintf("object %s has type %s, want %s", e.OID, gotName, wantName) 31}