package format
import "github.com/open-policy-agent/opa/format"
Package format implements formatting of Rego source files.
Index ¶
- func Ast(x interface{}) (formatted []byte, err error)
- func MustAst(x interface{}) []byte
- func Source(filename string, src []byte) ([]byte, error)
Functions ¶
func Ast ¶
Ast formats a Rego AST element. If the passed value is not a valid AST element, Ast returns nil and an error. If AST nodes are missing locations an arbitrary location will be used.
func MustAst ¶
func MustAst(x interface{}) []byte
MustAst is a helper function to format a Rego AST element. If any errors occurs this function will panic. This is mostly used for test
func Source ¶
Source formats a Rego source file. The bytes provided must describe a complete Rego module. If they don't, Source will return an error resulting from the attempt to parse the bytes.
Source Files ¶
- Version
- v0.30.2
- Published
- Jul 13, 2021
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 12 minutes ago –
Tools for package owners.