Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 1.12.3 to 1.13.1. - [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/v1.12.3...v1.13.1) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-version: 1.13.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
31 lines
849 B
Go
31 lines
849 B
Go
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (C) 2025 Aleksa Sarai <cyphar@cyphar.com>
|
|
// Copyright (C) 2025 SUSE LLC
|
|
//
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
// Package assert provides some basic assertion helpers for Go.
|
|
package assert
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// Assert panics if the predicate is false with the provided argument.
|
|
func Assert(predicate bool, msg any) {
|
|
if !predicate {
|
|
panic(msg)
|
|
}
|
|
}
|
|
|
|
// Assertf panics if the predicate is false and formats the message using the
|
|
// same formatting as [fmt.Printf].
|
|
//
|
|
// [fmt.Printf]: https://pkg.go.dev/fmt#Printf
|
|
func Assertf(predicate bool, fmtMsg string, args ...any) {
|
|
Assert(predicate, fmt.Sprintf(fmtMsg, args...))
|
|
}
|