Skip to content

Library: decorator wraps analyzers to supplement the results with additional details

License

Notifications You must be signed in to change notification settings

qawatake/decorator

Repository files navigation

decorator

Go Reference test codecov

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

package main

import (
  "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),
  )
}

About

Library: decorator wraps analyzers to supplement the results with additional details

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published