Skip to content

Commit efed678

Browse files
committed
more docs to Plain, Prod, and Dev
1 parent 4550b2e commit efed678

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

assert/assert.go

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,28 @@ type defInd = uint32
1818

1919
const (
2020
// Plain converts asserts just plain K&D error messages without extra
21-
// information.
21+
// information. That's useful for apps that want to use assert package to
22+
// validate e.g. command fields:
23+
//
24+
// assert.NotEmpty(c.PoolName, "pool name cannot be empty")
25+
//
26+
// Note, that Plain is only asserter that override auto-generated assertion
27+
// messages with given arguments like 'pool name cannot be empty'. Others
28+
// add given arguments at the end of the auto-generated assert message.
2229
Plain defInd = 0 + iota
2330

24-
// Production (pkg default) is the best asserter for most uses. The
31+
// Production (pkg default) is the best asserter for most cases. The
2532
// assertion violations are treated as Go error values. And only a
26-
// pragmatic caller info is automatically included into the error message
27-
// like file name, line number, and caller function, all in one line:
33+
// pragmatic caller info is included into the error values like source
34+
// filename, line number, and caller function, all in one line:
2835
//
2936
// copy file: main.go:37: CopyFile(): assertion violation: string shouldn't be empty
3037
Production
3138

32-
// Development is the best asserter for most development uses. The
33-
// assertion violations are treated as Go error values. And a formatted
34-
// caller info is automatically included to the error message like file
35-
// name, line number, and caller function. Everything in a beautiful
36-
// multi-line message:
39+
// Development is the best asserter for development use. The assertion
40+
// violations are treated as Go error values. And a formatted caller info
41+
// is included to the error message like source filename , line number, and
42+
// caller function. Everything in a noticeable multi-line message:
3743
//
3844
// --------------------------------
3945
// Assertion Fault at:

0 commit comments

Comments
 (0)