From 7339ecd8ca623f170f8a942ce08cc39a37b8bd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Pokorn=C3=BD?= Date: Sun, 10 Dec 2023 17:22:17 +0100 Subject: [PATCH] chore: enable more linters and address their findings. (#63) --- .golangci.yml | 10 +++++++--- parser.go | 2 +- value/floats.go | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index fb91925..3f4d3ed 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,11 +1,15 @@ linters: - # Disable all default linters and enable only revive and formatters before - # new findings by default linters are addressed. - disable-all: true enable: + - dupword + - errcheck + - errname + - godot - gofumpt - goimports + - misspell - revive + - unconvert + - unused issues: exclude-use-default: false diff --git a/parser.go b/parser.go index 12a4404..5093db5 100644 --- a/parser.go +++ b/parser.go @@ -11,7 +11,7 @@ import ( ) // ErrHelp is the error returned if the -help or -h flag is invoked but no such flag is defined. -// Alias for flag.ErrHelp +// Alias for flag.ErrHelp. var ErrHelp = flag.ErrHelp // Parser registers and parses configuration values. diff --git a/value/floats.go b/value/floats.go index 66e8244..f0abb71 100644 --- a/value/floats.go +++ b/value/floats.go @@ -43,10 +43,10 @@ func (iv *float64Value) Set(val string) error { return err } - *iv.dest = float64(num) + *iv.dest = num return nil } func (iv *float64Value) String() string { - return strconv.FormatFloat(float64(*iv.dest), 'G', -1, 64) + return strconv.FormatFloat(*iv.dest, 'G', -1, 64) }