Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qawatake/decorator
Library: decorator wraps analyzers to supplement the results with additional details
https://github.com/qawatake/decorator
go golang staticanalysis
Last synced: 7 days ago
JSON representation
Library: decorator wraps analyzers to supplement the results with additional details
- Host: GitHub
- URL: https://github.com/qawatake/decorator
- Owner: qawatake
- License: mit
- Created: 2023-10-28T04:58:09.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-28T11:09:29.000Z (about 1 year ago)
- Last Synced: 2024-10-29T12:57:12.203Z (about 2 months ago)
- Topics: go, golang, staticanalysis
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# decorator
[![Go Reference](https://pkg.go.dev/badge/github.com/qawatake/decorator.svg)](https://pkg.go.dev/github.com/qawatake/decorator)
[![test](https://github.com/qawatake/decorator/actions/workflows/test.yaml/badge.svg)](https://github.com/qawatake/decorator/actions/workflows/test.yaml)
[![codecov](https://codecov.io/gh/qawatake/decorator/graph/badge.svg?token=5BB1k2a601)](https://codecov.io/gh/qawatake/decorator)Library `decorator` wraps analyzers to supplement the results with additional details.
Before
```
internal/example/example.go:11:16: nil dereference in field selection
```After
```
internal/example/example.go:11:16: 😱 nil dereference in field selection (nilness)
```## How to use
```go
package mainimport (
"github.com/qawatake/decorator""golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/nilness"
"golang.org/x/tools/go/analysis/unitchecker"
)func main() {
unitchecker.Main(
decorator.With(
func(a *analysis.Analyzer, d analysis.Diagnostic) analysis.Diagnostic {
d.Message = "😱 " + d.Message + " (" + a.Name + ")"
return d
},
)(nilness.Analyzer),
)
}
```