Skip to content

Commit

Permalink
docs(README.md): update installation command and usage examples
Browse files Browse the repository at this point in the history
- Change installation command to use `go install` with `@latest` tag for up-to-date installation.
- Add alternative usage example with `-test` flag and clarify usage with `or` for different scenarios.
- Introduce new section "Independent features of `rdeadcode`" explaining additional flags `-file` and `-function`.
- Remove outdated usage example and improve documentation formatting.
  • Loading branch information
yyoshiki41 committed May 5, 2024
1 parent 0646a71 commit 0c0a4c8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@ Parse the output of [deadcode](https://go.dev/blog/deadcode) and remove(rewrite)
## Installation

```shell
go get -u github.com/yyoshiki41/rdeadcode
go install github.com/yyoshiki41/rdeadcode@latest
```

## Usage

```shell
deadcode -json ./path/to/your/project | rdeadcode
// equivalent to
deadcode -json -test ./path/to/your/project | rdeadcode
```

or

```shell
rdeadcode -json deadcode.json
```

or passed the args to `rdeadcode` directly.
### Independent features of `rdeadcode`

passed the argument `-file` and `-function` to remove the dead code from the file.

```shell
// remove the dead function from the file
rdeadcode -file path/to/your/file.go -function deadFunction
```

Expand All @@ -29,7 +34,7 @@ rdeadcode -file path/to/your/file.go -function deadFunction
> _deadcode_ detects methods that implement an interface as dead code if it is not used in the project.
Please verify the interface compliance at compile time and restore the method when rdeadcode removes it.

```go
// Verify interface compliance at compile time
var _ fmt.Stringer = myString{}
Expand Down

0 comments on commit 0c0a4c8

Please sign in to comment.