Merge pull request #929 from ewohltman/master
Re-enable `gomnd` linter with release > v1.23.0
This commit is contained in:
commit
a5b55982aa
@ -74,7 +74,7 @@ linters:
|
|||||||
- gofmt
|
- gofmt
|
||||||
- goimports
|
- goimports
|
||||||
- golint
|
- golint
|
||||||
# - gomnd TODO: enable it with release > v1.23.0
|
- gomnd
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosec
|
- gosec
|
||||||
- gosimple
|
- gosimple
|
||||||
|
@ -1015,7 +1015,7 @@ linters:
|
|||||||
- gofmt
|
- gofmt
|
||||||
- goimports
|
- goimports
|
||||||
- golint
|
- golint
|
||||||
# - gomnd TODO: enable it with release > v1.23.0
|
- gomnd
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosec
|
- gosec
|
||||||
- gosimple
|
- gosimple
|
||||||
|
15
test/testdata/govet_custom_formatter/main.go
vendored
15
test/testdata/govet_custom_formatter/main.go
vendored
@ -10,12 +10,15 @@ const (
|
|||||||
escape = "\x1b"
|
escape = "\x1b"
|
||||||
reset = escape + "[0m"
|
reset = escape + "[0m"
|
||||||
green = escape + "[32m"
|
green = escape + "[32m"
|
||||||
|
|
||||||
|
minValue = 0.0
|
||||||
|
maxValue = 1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
// Bar is a progress bar.
|
// Bar is a progress bar.
|
||||||
type Bar float64
|
type Bar float64
|
||||||
|
|
||||||
var _ fmt.Formatter = Bar(1.0)
|
var _ fmt.Formatter = Bar(maxValue)
|
||||||
|
|
||||||
// Format the progress bar as output
|
// Format the progress bar as output
|
||||||
func (h Bar) Format(state fmt.State, r rune) {
|
func (h Bar) Format(state fmt.State, r rune) {
|
||||||
@ -25,16 +28,16 @@ func (h Bar) Format(state fmt.State, r rune) {
|
|||||||
panic(fmt.Sprintf("%v: unexpected format character", float64(h)))
|
panic(fmt.Sprintf("%v: unexpected format character", float64(h)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if h > 1.0 {
|
if h > maxValue {
|
||||||
h = 1.0
|
h = maxValue
|
||||||
}
|
}
|
||||||
|
|
||||||
if h < 0.0 {
|
if h < minValue {
|
||||||
h = 0.0
|
h = minValue
|
||||||
}
|
}
|
||||||
|
|
||||||
if state.Flag('-') {
|
if state.Flag('-') {
|
||||||
h = 1.0 - h
|
h = maxValue - h
|
||||||
}
|
}
|
||||||
|
|
||||||
width, ok := state.Width()
|
width, ok := state.Width()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user