Skip to content

Commit

Permalink
doc: update usage and limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
Abirdcfly committed Sep 10, 2022
1 parent 97e8762 commit aa17437
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
Expand Down Expand Up @@ -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 ./...
Expand All @@ -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
Expand Down

0 comments on commit aa17437

Please sign in to comment.