mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
84b23ccedd
This commit fixes an issue when upgrading codebases to OPA v1.7.0. In PR #7797, we introduced the ability to provide "branding" information in OPA commands and help messages, which would allow easier customized OPA distributions in the future. However, this changeset removed the public symbol `cmd.RootCommand`, and required refactoring to use `cmd.Command`, which breaks automated upgrades, such as those done by Dependabot. This PR adds back the missing symbol, with the original/default "OPA" branding provided. This should allow existing codebases to upgrade without requiring any code changes. Signed-off-by: Philip Conrad <philip@chariot-chaser.net>
35 lines
811 B
Go
35 lines
811 B
Go
// Copyright 2016 The OPA Authors. All rights reserved.
|
|
// Use of this source code is governed by an Apache2
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
|
|
"github.com/open-policy-agent/opa/cmd"
|
|
)
|
|
|
|
func main() {
|
|
var exit int
|
|
defer func() {
|
|
if exit != 0 {
|
|
os.Exit(exit)
|
|
}
|
|
}() // orderly shutdown, run all defer routines
|
|
|
|
if err := cmd.RootCommand.Execute(); err != nil {
|
|
var e *cmd.ExitError
|
|
if errors.As(err, &e) {
|
|
exit = e.Exit
|
|
} else {
|
|
exit = 1
|
|
}
|
|
}
|
|
}
|
|
|
|
//go:generate build/gen-run-go.sh internal/cmd/genopacapabilities/main.go capabilities.json
|
|
//go:generate build/gen-run-go.sh internal/cmd/genbuiltinmetadata/main.go builtin_metadata.json
|
|
//go:generate build/gen-run-go.sh internal/cmd/genversionindex/main.go v1/ast/version_index.json
|