build(deps): bump github.com/open-policy-agent/opa from 0.60.0 to 0.61.0
Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 0.60.0 to 0.61.0. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v0.60.0...v0.61.0) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
7980be48a1
commit
690d44cfb0
+7
-17
@@ -26,20 +26,10 @@ type Opts struct {
|
||||
// carry along their original source locations.
|
||||
IgnoreLocations bool
|
||||
|
||||
// RegoV1 is equivalent to setting RegoVersion to ast.RegoV0Compat1.
|
||||
// RegoV1 takes precedence over RegoVersion.
|
||||
// Deprecated: use RegoVersion instead.
|
||||
RegoV1 bool
|
||||
// RegoVersion is the version of Rego to format code for.
|
||||
RegoVersion ast.RegoVersion
|
||||
}
|
||||
|
||||
func (o *Opts) effectiveRegoVersion() ast.RegoVersion {
|
||||
if o.RegoV1 {
|
||||
return ast.RegoV0CompatV1
|
||||
}
|
||||
return o.RegoVersion
|
||||
}
|
||||
|
||||
// defaultLocationFile is the file name used in `Ast()` for terms
|
||||
// without a location, as could happen when pretty-printing the
|
||||
// results of partial eval.
|
||||
@@ -54,7 +44,7 @@ func Source(filename string, src []byte) ([]byte, error) {
|
||||
|
||||
func SourceWithOpts(filename string, src []byte, opts Opts) ([]byte, error) {
|
||||
parserOpts := ast.ParserOptions{}
|
||||
if opts.effectiveRegoVersion() == ast.RegoV1 {
|
||||
if opts.RegoVersion == ast.RegoV1 {
|
||||
// If the rego version is V1, wee need to parse it as such, to allow for future keywords not being imported.
|
||||
// Otherwise, we'll default to RegoV0
|
||||
parserOpts.RegoVersion = ast.RegoV1
|
||||
@@ -65,7 +55,7 @@ func SourceWithOpts(filename string, src []byte, opts Opts) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if opts.effectiveRegoVersion() == ast.RegoV0CompatV1 || opts.effectiveRegoVersion() == ast.RegoV1 {
|
||||
if opts.RegoVersion == ast.RegoV0CompatV1 || opts.RegoVersion == ast.RegoV1 {
|
||||
errors := ast.CheckRegoV1(module)
|
||||
if len(errors) > 0 {
|
||||
return nil, errors
|
||||
@@ -133,7 +123,7 @@ func AstWithOpts(x interface{}, opts Opts) ([]byte, error) {
|
||||
|
||||
o := fmtOpts{}
|
||||
|
||||
if opts.effectiveRegoVersion() == ast.RegoV0CompatV1 || opts.effectiveRegoVersion() == ast.RegoV1 {
|
||||
if opts.RegoVersion == ast.RegoV0CompatV1 || opts.RegoVersion == ast.RegoV1 {
|
||||
o.regoV1 = true
|
||||
o.ifs = true
|
||||
o.contains = true
|
||||
@@ -194,13 +184,13 @@ func AstWithOpts(x interface{}, opts Opts) ([]byte, error) {
|
||||
|
||||
switch x := x.(type) {
|
||||
case *ast.Module:
|
||||
if opts.effectiveRegoVersion() == ast.RegoV1 {
|
||||
if opts.RegoVersion == ast.RegoV1 {
|
||||
x.Imports = filterRegoV1Import(x.Imports)
|
||||
} else if opts.effectiveRegoVersion() == ast.RegoV0CompatV1 {
|
||||
} else if opts.RegoVersion == ast.RegoV0CompatV1 {
|
||||
x.Imports = ensureRegoV1Import(x.Imports)
|
||||
}
|
||||
|
||||
if opts.effectiveRegoVersion() == ast.RegoV0CompatV1 || opts.effectiveRegoVersion() == ast.RegoV1 || moduleIsRegoV1Compatible(x) {
|
||||
if opts.RegoVersion == ast.RegoV0CompatV1 || opts.RegoVersion == ast.RegoV1 || moduleIsRegoV1Compatible(x) {
|
||||
x.Imports = future.FilterFutureImports(x.Imports)
|
||||
} else {
|
||||
for kw := range extraFutureKeywordImports {
|
||||
|
||||
Reference in New Issue
Block a user