Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
add golangci-lint config
  • Loading branch information
jjti committed Feb 8, 2024
1 parent 1536a9c commit 9cab7e9
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,37 @@ func _() error {

## Configuration

### golangci-lint

Docs on configuring the linter are also available at [https://golangci-lint.run/usage/linters/#spancheck](https://golangci-lint.run/usage/linters/#spancheck):

```yaml
linters:
enable:
- spancheck

linters-settings:
spancheck:
# Checks to enable.
# Options include:
# - `end`: check that `span.End()` is called
# - `record-error`: check that `span.RecordError(err)` is called when an error is returned
# - `set-status`: check that `span.SetStatus(codes.Error, msg)` is called when an error is returned
# Default: ["end"]
checks:
- end
- record-error
- set-status
# A list of regexes for function signatures that silence `record-error` and `set-status` reports
# if found in the call path to a returned error.
# https://github.com/jjti/go-spancheck#ignore-check-signatures
# Default: []
ignore-check-signatures:
- "telemetry.RecordError"
```
### CLI
Only the `span.End()` check is enabled by default. The others can be enabled with `-checks 'end,set-status,record-error'`.

```txt
Expand All @@ -55,7 +86,7 @@ Flags:
comma-separated list of regex for function signatures that disable checks on errors
```

### Ignore check signatures
### Ignore Check Signatures

The `span.SetStatus()` and `span.RecordError()` checks warn when there is:

Expand Down

0 comments on commit 9cab7e9

Please sign in to comment.