frostfs-node/internal/assert/cond.go
Ekaterina Lebedeva 4c03561aa2
Some checks failed
Tests and linters / gopls check (push) Failing after 59s
Vulncheck / Vulncheck (push) Successful in 1m12s
Pre-commit hooks / Pre-commit (push) Successful in 1m35s
Build / Build Components (push) Successful in 1m49s
Tests and linters / Run gofumpt (push) Successful in 3m29s
Tests and linters / Staticcheck (push) Successful in 3m52s
Tests and linters / Lint (push) Successful in 4m30s
Tests and linters / Tests (push) Successful in 4m31s
OCI image / Build container images (push) Successful in 4m54s
Tests and linters / Tests with -race (push) Successful in 6m51s
[#1693] internal/assert: Add False and NoError checks
Change-Id: Ib3ab1671eeff8e8917673513477f158cadbb4287
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
2025-04-08 14:34:53 +03:00

25 lines
395 B
Go

package assert
import (
"fmt"
"strings"
)
func True(cond bool, details ...string) {
if !cond {
panic(strings.Join(details, " "))
}
}
func False(cond bool, details ...string) {
if cond {
panic(strings.Join(details, " "))
}
}
func NoError(err error, details ...string) {
if err != nil {
content := fmt.Sprintf("BUG: %v: %s", err, strings.Join(details, " "))
panic(content)
}
}