MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Must

Function Must

pkg/util/test/util.go:61–66  ·  view source on GitHub ↗

Must returns v if err is nil and panics otherwise.

(v T, err error)

Source from the content-addressed store, hash-verified

59
60// Must returns v if err is nil and panics otherwise.
61func Must[T any](v T, err error) T {
62 if err != nil {
63 panic(fmt.Sprintf("Must received error: %v", FormatError(err)))
64 }
65 return v
66}
67
68// WaitTimeout returns true if f returns after at most d or false otherwise.
69// An example of a f, for which this is useful would be Wait method of sync.WaitGroup.

Callers 15

TestLoRaWANEncodingMACFunction · 0.92
TestCacheKeyVaultFunction · 0.92
TestMarshalFunction · 0.92
TestMuxFunction · 0.92
TestBatchOperationsFunction · 0.92
TestUpstreamFunction · 0.92
TestComponentFunction · 0.92

Calls 1

FormatErrorFunction · 0.85

Tested by 15

TestLoRaWANEncodingMACFunction · 0.74
TestCacheKeyVaultFunction · 0.74
TestMarshalFunction · 0.74
TestMuxFunction · 0.74
TestBatchOperationsFunction · 0.74
TestUpstreamFunction · 0.74
TestComponentFunction · 0.74