aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golangci/goconst/README.md
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-07-04 11:12:55 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-04 15:05:30 +0200
commitc7d7f10bdff703e4a3c0414e8a33d4e45c91eb35 (patch)
tree0dff0ee1f98dbfa3ad8776112053a450d176592b /vendor/github.com/golangci/goconst/README.md
parent9573094ce235bd9afe88f5da27a47dd6bcc1e13b (diff)
go.mod: vendor golangci-lint
Diffstat (limited to 'vendor/github.com/golangci/goconst/README.md')
-rw-r--r--vendor/github.com/golangci/goconst/README.md49
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/github.com/golangci/goconst/README.md b/vendor/github.com/golangci/goconst/README.md
new file mode 100644
index 000000000..04fc9b015
--- /dev/null
+++ b/vendor/github.com/golangci/goconst/README.md
@@ -0,0 +1,49 @@
+# goconst
+
+Find repeated strings that could be replaced by a constant.
+
+### Motivation
+
+There are obvious benefits to using constants instead of repeating strings, mostly to ease maintenance. Cannot argue against changing a single constant versus many strings.
+
+While this could be considered a beginner mistake, across time, multiple packages and large codebases, some repetition could have slipped in.
+
+### Get Started
+
+ $ go get github.com/jgautheron/goconst/cmd/goconst
+ $ goconst ./...
+
+### Usage
+
+```
+Usage:
+
+ goconst ARGS <directory>
+
+Flags:
+
+ -ignore exclude files matching the given regular expression
+ -ignore-tests exclude tests from the search (default: true)
+ -min-occurrences report from how many occurrences (default: 2)
+ -min-length only report strings with the minimum given length (default: 3)
+ -match-constant look for existing constants matching the values
+ -numbers search also for duplicated numbers
+ -min minimum value, only works with -numbers
+ -max maximum value, only works with -numbers
+ -output output formatting (text or json)
+
+Examples:
+
+ goconst ./...
+ goconst -ignore "yacc|\.pb\." $GOPATH/src/github.com/cockroachdb/cockroach/...
+ goconst -min-occurrences 3 -output json $GOPATH/src/github.com/cockroachdb/cockroach
+ goconst -numbers -min 60 -max 512 .
+```
+
+### Other static analysis tools
+
+- [gogetimports](https://github.com/jgautheron/gogetimports): Get a JSON-formatted list of imports.
+- [usedexports](https://github.com/jgautheron/usedexports): Find exported variables that could be unexported.
+
+### License
+MIT