From e76db1ae58899fe72dafda41c0542392101307f9 Mon Sep 17 00:00:00 2001 From: Eric Wohltman Date: Mon, 20 Jan 2020 09:16:04 -0500 Subject: [PATCH 1/3] Re-enable `gomnd` linter with release > v1.23.0 --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index f5a389be4936..e58433951940 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -74,7 +74,7 @@ linters: - gofmt - goimports - golint -# - gomnd TODO: enable it with release > v1.23.0 + - gomnd - goprintffuncname - gosec - gosimple From cc8b9101d629f4f7135803790e6509f2250a6e6f Mon Sep 17 00:00:00 2001 From: Eric Wohltman Date: Mon, 20 Jan 2020 09:37:58 -0500 Subject: [PATCH 2/3] Fix test failure from `gomnd` --- test/testdata/govet_custom_formatter/main.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/testdata/govet_custom_formatter/main.go b/test/testdata/govet_custom_formatter/main.go index d005fd7ef21d..576e83ed4672 100644 --- a/test/testdata/govet_custom_formatter/main.go +++ b/test/testdata/govet_custom_formatter/main.go @@ -10,12 +10,15 @@ const ( escape = "\x1b" reset = escape + "[0m" green = escape + "[32m" + + minValue = 0.0 + maxValue = 1.0 ) // Bar is a progress bar. type Bar float64 -var _ fmt.Formatter = Bar(1.0) +var _ fmt.Formatter = Bar(maxValue) // Format the progress bar as output 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))) } - if h > 1.0 { - h = 1.0 + if h > maxValue { + h = maxValue } - if h < 0.0 { - h = 0.0 + if h < minValue { + h = minValue } if state.Flag('-') { - h = 1.0 - h + h = maxValue - h } width, ok := state.Width() From b248dc5f970aab487a85cd23d8a76001bc7666b3 Mon Sep 17 00:00:00 2001 From: Eric Wohltman Date: Mon, 20 Jan 2020 09:49:13 -0500 Subject: [PATCH 3/3] Run `make --always-make fast_generate` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 61aafc9cb5ef..a3894f2ff7d1 100644 --- a/README.md +++ b/README.md @@ -1015,7 +1015,7 @@ linters: - gofmt - goimports - golint -# - gomnd TODO: enable it with release > v1.23.0 + - gomnd - goprintffuncname - gosec - gosimple