Golang Testify: require vs assert

Simplify Complexity
FreeThreads
Published in
1 min readNov 30, 2021

--

Library Code

assert is a boolean test. An example implementation is following:

package assertfunc Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
if err == nil {
if h, ok := t.(tHelper); ok {
h.Helper()
}
// Prints error trace, test details and error message
return Fail(t, "An error is expected but got nil.", msgAndArgs...)
}
return true
}

--

--

Simplify Complexity
FreeThreads

Golang, Distributed Systems, File Systems, Python, C/C++, Linux