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 Bytes(src []byte) ([]byte, error)
- 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. Ast relies on all AST elements having non-nil Location values, and will return an error if this is not the case.
func Bytes ¶
Bytes formats Rego source code. The bytes provided do not have to be an entire source file, but they must be parse-able. If the bytes are not parse-able, Bytes will return an error resulting from the attempt to parse them.
func Source ¶
Source formats a Rego source file. The bytes provided must decribe 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.7.0
- Published
- Feb 22, 2018
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 1 hour ago –
Tools for package owners.