Skip to content

Commit

Permalink
Bump OPA to v1.1.0 (#1373)
Browse files Browse the repository at this point in the history
+ Roast v0.7.0.

And get rid of things we've upstreamed :)

Signed-off-by: Anders Eknert <[email protected]>
  • Loading branch information
anderseknert authored Jan 27, 2025
1 parent 6430f86 commit 14cbc3b
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 94 deletions.
2 changes: 1 addition & 1 deletion cmd/debugger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
"os"
"strings"

"github.com/anderseknert/roast/pkg/util"
godap "github.com/google/go-dap"
"github.com/spf13/cobra"

"github.com/open-policy-agent/opa/v1/ast/location"
"github.com/open-policy-agent/opa/v1/debug"
"github.com/open-policy-agent/opa/v1/logging"
"github.com/open-policy-agent/opa/v1/rego"
"github.com/open-policy-agent/opa/v1/util"

"github.com/styrainc/regal/internal/dap"
"github.com/styrainc/regal/pkg/builtins"
Expand Down
3 changes: 2 additions & 1 deletion cmd/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"os"

"github.com/anderseknert/roast/pkg/encoding"
"github.com/anderseknert/roast/pkg/util"
"github.com/spf13/cobra"

"github.com/open-policy-agent/opa/v1/util"

rp "github.com/styrainc/regal/internal/parse"
)

Expand Down
24 changes: 11 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.23.3

require (
dario.cat/mergo v1.0.1
github.com/anderseknert/roast v0.6.0
github.com/anderseknert/roast v0.7.0
github.com/coreos/go-semver v0.3.1
github.com/fatih/color v1.18.0
github.com/fsnotify/fsnotify v1.8.0
Expand All @@ -17,7 +17,7 @@ require (
github.com/jstemmer/go-junit-report/v2 v2.1.0
github.com/mitchellh/mapstructure v1.5.0
github.com/olekukonko/tablewriter v0.0.5
github.com/open-policy-agent/opa v1.0.0
github.com/open-policy-agent/opa v1.1.0
github.com/owenrumney/go-sarif/v2 v2.3.3
github.com/pdevine/go-asciisprite v0.1.6
github.com/pkg/profile v1.7.0
Expand All @@ -36,7 +36,6 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
Expand All @@ -47,7 +46,6 @@ require (
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
Expand All @@ -72,22 +70,22 @@ require (
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
github.com/tchap/go-patricia/v2 v2.3.2 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yashtewari/glob-intersection v0.2.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.33.0 // indirect
go.opentelemetry.io/otel/metric v1.33.0 // indirect
go.opentelemetry.io/otel/sdk v1.33.0 // indirect
go.opentelemetry.io/otel/trace v1.33.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
go.opentelemetry.io/otel/metric v1.34.0 // indirect
go.opentelemetry.io/otel/sdk v1.34.0 // indirect
go.opentelemetry.io/otel/trace v1.34.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/protobuf v1.35.2 // indirect
google.golang.org/protobuf v1.36.3 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
106 changes: 48 additions & 58 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/explorer/stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"context"

"github.com/anderseknert/roast/pkg/encoding"
"github.com/anderseknert/roast/pkg/util"

"github.com/open-policy-agent/opa/v1/ast"
"github.com/open-policy-agent/opa/v1/bundle"
"github.com/open-policy-agent/opa/v1/compile"
"github.com/open-policy-agent/opa/v1/ir"
"github.com/open-policy-agent/opa/v1/util"

compile2 "github.com/styrainc/regal/internal/compile"
"github.com/styrainc/regal/internal/parse"
Expand Down
3 changes: 1 addition & 2 deletions internal/lsp/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"fmt"
"os"

"github.com/anderseknert/roast/pkg/util"

"github.com/open-policy-agent/opa/v1/ast"
"github.com/open-policy-agent/opa/v1/util"

"github.com/styrainc/regal/internal/lsp/types"
"github.com/styrainc/regal/internal/util/concurrent"
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/completions/refs/defined.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"slices"
"strings"

"github.com/anderseknert/roast/pkg/util"
"gopkg.in/yaml.v3"

"github.com/open-policy-agent/opa/v1/ast"
"github.com/open-policy-agent/opa/v1/util"

rast "github.com/styrainc/regal/internal/ast"
"github.com/styrainc/regal/internal/lsp/types"
Expand Down
3 changes: 1 addition & 2 deletions internal/lsp/opa/oracle/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ package oracle
import (
"errors"

"github.com/anderseknert/roast/pkg/util"

"github.com/open-policy-agent/opa/v1/ast"
"github.com/open-policy-agent/opa/v1/util"

"github.com/styrainc/regal/internal/compile"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/opa/scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"unicode"
"unicode/utf8"

"github.com/anderseknert/roast/pkg/util"
"github.com/open-policy-agent/opa/v1/util"

"github.com/styrainc/regal/internal/lsp/opa/tokens"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import (
"time"

"github.com/anderseknert/roast/pkg/encoding"
rutil "github.com/anderseknert/roast/pkg/util"
"github.com/sourcegraph/jsonrpc2"
"gopkg.in/yaml.v3"

"github.com/open-policy-agent/opa/v1/ast"
"github.com/open-policy-agent/opa/v1/format"
"github.com/open-policy-agent/opa/v1/storage"
outil "github.com/open-policy-agent/opa/v1/util"

rbundle "github.com/styrainc/regal/bundle"
"github.com/styrainc/regal/internal/capabilities"
Expand Down Expand Up @@ -1791,7 +1791,7 @@ func (l *LanguageServer) handleTextDocumentDefinition(params types.DefinitionPar
Filename: uri.ToPath(l.clientIdentifier, params.TextDocument.URI),
Pos: positionToOffset(contents, params.Position),
Modules: modules,
Buffer: rutil.StringToByteSlice(contents),
Buffer: outil.StringToByteSlice(contents),
}

definition, err := orc.FindDefinition(query)
Expand Down
6 changes: 3 additions & 3 deletions pkg/linter/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/anderseknert/roast/pkg/encoding"
"github.com/anderseknert/roast/pkg/transform"
rutil "github.com/anderseknert/roast/pkg/util"
"github.com/gobwas/glob"
"gopkg.in/yaml.v3"

Expand All @@ -25,6 +24,7 @@ import (
"github.com/open-policy-agent/opa/v1/rego"
"github.com/open-policy-agent/opa/v1/topdown"
"github.com/open-policy-agent/opa/v1/topdown/print"
outil "github.com/open-policy-agent/opa/v1/util"

rbundle "github.com/styrainc/regal/bundle"
rio "github.com/styrainc/regal/internal/io"
Expand Down Expand Up @@ -804,7 +804,7 @@ func loadModulesFromCustomRuleFS(customRuleFS fs.FS, rootPath string) (map[strin
return fmt.Errorf("failed to read custom rule file: %w", err)
}

files[path] = rutil.ByteSliceToString(bs)
files[path] = outil.ByteSliceToString(bs)

return nil
})
Expand Down Expand Up @@ -1075,7 +1075,7 @@ func (l Linter) GetConfig() (*config.Config, error) {
}

log.Println("merged provided and user config:")
log.Println(rutil.ByteSliceToString(bs))
log.Println(outil.ByteSliceToString(bs))
}

l.combinedCfg = &mergedConf
Expand Down
5 changes: 3 additions & 2 deletions pkg/reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import (
"strings"

"github.com/anderseknert/roast/pkg/encoding"
rutil "github.com/anderseknert/roast/pkg/util"
"github.com/fatih/color"
"github.com/jstemmer/go-junit-report/v2/junit"
"github.com/olekukonko/tablewriter"
"github.com/owenrumney/go-sarif/v2/sarif"

outil "github.com/open-policy-agent/opa/v1/util"

"github.com/styrainc/regal/internal/mode"
"github.com/styrainc/regal/internal/novelty"
"github.com/styrainc/regal/internal/util"
Expand Down Expand Up @@ -330,7 +331,7 @@ func (tr JSONReporter) Publish(_ context.Context, r report.Report) error {
return fmt.Errorf("json marshalling of report failed: %w", err)
}

_, err = fmt.Fprintln(tr.out, rutil.ByteSliceToString(bs))
_, err = fmt.Fprintln(tr.out, outil.ByteSliceToString(bs))

return err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/rules/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import (
"context"
"fmt"

"github.com/anderseknert/roast/pkg/util"

"github.com/open-policy-agent/opa/v1/ast"
"github.com/open-policy-agent/opa/v1/format"
"github.com/open-policy-agent/opa/v1/util"

"github.com/styrainc/regal/internal/docs"
"github.com/styrainc/regal/pkg/config"
Expand Down
9 changes: 4 additions & 5 deletions pkg/rules/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import (
"strings"
"sync"

rutil "github.com/anderseknert/roast/pkg/util"

"github.com/open-policy-agent/opa/v1/ast"
outil "github.com/open-policy-agent/opa/v1/util"

"github.com/styrainc/regal/internal/parse"
"github.com/styrainc/regal/internal/util"
Expand Down Expand Up @@ -120,7 +119,7 @@ func InputFromPaths(paths []string, prefix string, versionsMap map[string]ast.Re
return
}

fileContent[result.name] = rutil.ByteSliceToString(result.raw)
fileContent[result.name] = outil.ByteSliceToString(result.raw)
modules[result.name] = result.parsed
}(path)
}
Expand Down Expand Up @@ -205,7 +204,7 @@ func regoWithOpts(path string, opts ast.ParserOptions) (*regoFile, error) {
raw: bs,
}

policy := rutil.ByteSliceToString(bs)
policy := outil.ByteSliceToString(bs)

mod, err := parse.ModuleWithOpts(path, policy, opts)
if err != nil {
Expand All @@ -225,7 +224,7 @@ func inputFromStdin() (Input, error) {
return Input{}, fmt.Errorf("failed to read from reader: %w", err)
}

policy := rutil.ByteSliceToString(bs)
policy := outil.ByteSliceToString(bs)

module, err := parse.ModuleUnknownVersionWithOpts("stdin", policy, parse.ParserOptions())
if err != nil {
Expand Down

0 comments on commit 14cbc3b

Please sign in to comment.