From aa174378378ddc88b286ea3b14b22730cdd8edb2 Mon Sep 17 00:00:00 2001 From: Abirdcfly Date: Sat, 10 Sep 2022 23:09:05 +0800 Subject: [PATCH] doc: update usage and limitation --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 67535ea..f12c53e 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,8 @@ go install github.com/Abirdcfly/dupword/cmd/dupword@main ### 1. default Run with default settings(include test file): -**But note that not all repeated words are wrong** + +**But note that not all repeated words are wrong** see [dupword#4](https://github.com/Abirdcfly/dupword/issues/4) for real code example. ```bash $ dupword ./... @@ -127,7 +128,9 @@ Flags: ### 5. my advice -use `--keyword=the,and,a` and `-fix` together. +use `--keyword=the,and,a` and `-fix` together. I personally think that specifying only common repeated prepositions can effectively avoid false positives. + +see [dupword#4](https://github.com/Abirdcfly/dupword/issues/4) for real code example. ```bash $ dupword --keyword=the,and,a -fix ./... @@ -141,8 +144,7 @@ $ dupword --keyword=the,and,a -fix ./... ## Limitation 1. Only for `*.go` file.But some miswritten occurs in `*.md` or `*.json` file.(example: kubernetes), In this case, my advice is to use [rg](https://github.com/BurntSushi/ripgrep) to do the lookup and replace manually. -2. The first time, `-fix` args can't auto-fix `*_test.go` file, you need to run the command once again, this is a bug of golang/x/tools, see [https://github.com/golang/go/issues/54740](https://github.com/golang/go/issues/54740) for more information and it will be fixed by ~~[CL 426594](https://go-review.googlesource.com/c/tools/+/426594)~~ [CL 426734](https://go-review.googlesource.com/c/tools/+/426734/) . (ps: This problem occurs with basically all linters that use the `go/analysis` package), In this case, my advice is to run the linter command multiple times.:sweat_smile: -3. When use `-fix`, also running `go fmt` in the dark.([This logic is determined upstream](https://github.com/golang/tools/blob/248c34b88a4148128f89e41923498bd86f805b7d/go/analysis/internal/checker/checker.go#L424-L433), the project does not have this part of the code.) +2. When use `-fix`, also running `go fmt` in the dark.([This logic is determined upstream](https://github.com/golang/tools/blob/248c34b88a4148128f89e41923498bd86f805b7d/go/analysis/internal/checker/checker.go#L424-L433), the project does not have this part of the code.) ## License