Source File
int.go
Belonging Package
github.com/go-git/gcfg/types
package types
import (
)
func ( IntMode) () string {
var []string
if &Dec != 0 {
= append(, "Dec")
}
if &Hex != 0 {
= append(, "Hex")
}
if &Oct != 0 {
= append(, "Oct")
}
return "IntMode(" + strings.Join(, "|") + ")"
}
var errIntAmbig = fmt.Errorf("ambiguous integer value; must include '0' prefix")
func ( string) bool {
return strings.HasPrefix(, "0") || strings.HasPrefix(, "-0")
}
func ( string) bool {
return strings.HasPrefix(, "0x") || strings.HasPrefix(, "-0x")
}
func ( interface{}, string, IntMode) error {
= strings.TrimSpace()
:= byte(0)
switch {
case Dec:
= 'd'
case Dec + Hex:
if prefix0x() {
= 'v'
} else {
= 'd'
}
case Dec + Oct:
if prefix0() && !prefix0x() {
= 'v'
} else {
= 'd'
}
case Dec + Hex + Oct:
= 'v'
case Hex:
if prefix0x() {
= 'v'
} else {
= 'x'
}
case Oct:
= 'o'
case Hex + Oct:
if prefix0() {
= 'v'
} else {
return errIntAmbig
}
}
if == 0 {
panic("unsupported mode")
}
return ScanFully(, , )
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |