Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By m-mizutaniv0.1.0Apache-2.0In 1 marketplace
Writes and debugs Rego policies that enforce your team's own Go conventions with goast, covering the AST input format and goast test.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
1 marketplace, most starred first
rego, opa, static-analysis, go-linting, ast, policy-as-code, goast, lint
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Go AST based static analysis for Go, with rules written as Rego policies. Encode your team's own conventions once and enforce them in CI.
Go has many excellent static analysis tools, but they check common best
practices. Every team also has its own rules — internal conventions, "this
resource must be initialized first", "use our error wrapper, not fmt.Errorf" —
that a generic linter cannot know about. goast splits a linter into
implementation (goast itself) and policy (Rego you write), so you can express
those rules yourself. It runs OPA/Rego over
the Go AST, one node at a time.
goast test), so rules can't driftInstall with Homebrew:
brew install m-mizutani/tap/goast
Or install with go install (pre-built binaries for Linux, macOS, and Windows
are also on each GitHub Release):
go install github.com/m-mizutani/goast/cmd/goast@latest
Write a policy in package goast. Each rule matches one AST node and adds to the
fail set. This one forbids fmt.Println:
package goast
fail contains res if {
input.Kind == "ExprStmt"
input.Node.X.Fun.X.Name == "fmt"
input.Node.X.Fun.Sel.Name == "Println"
res := {
"msg": "do not use fmt.Println",
"pos": input.Node.X.Fun.X.NamePos,
"sev": "ERROR",
}
}
Evaluate a file (or a directory, or ./...) against it:
$ goast eval -p ./policy/do_not_use_println.rego examples/println/main.go
[examples/println/main.go:6] - do not use fmt.Println
fmt.Println("hello")
~~~~~~~~~~~~~~~~~~~~
Detected 1 violations
Pass --fail to make violations exit non-zero — that is your CI gate.
goast parses each Go file into a go/ast tree and evaluates the query
data.goast.fail against every node, with the node as input. A policy is
therefore a set of pattern matches over single nodes: input.Kind is the node
type, input.Node is the node itself, and each match returns a {msg, pos, sev}
result. Use goast dump to see the exact shape of any node.
eval, test, dump, sync, and every flag..goast.toml schema ([eval] / [test]) and flag precedence.This repository ships a Claude Code skill,
goast-policy, that guides Claude through writing and testing goast policies.
Install it as a plugin:
/plugin marketplace add m-mizutani/goast
/plugin install goast-policy@goast
Then ask Claude to write a policy (e.g. "write a goast policy that forbids
fmt.Println"), or read skills/goast-policy/SKILL.md.
Apache License v2
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub m-mizutani/goast --plugin goast-policyPlugins from other owners that cover similar ground