@@ -851,7 +851,7 @@ func MNotEmpty[M ~map[T]U, T comparable, U any](obj M, a ...any) {
851
851
}
852
852
853
853
func doNamed (not , tname , got string , a []any ) {
854
- not = x .Whom (not == assertionNot , " not " , "" )
854
+ not = x .Whom (not == assertionNot , " not " , " " )
855
855
defMsg := assertionMsg + ": " + tname + " should" + not + "be " + got
856
856
current ().reportAssertionFault (1 , defMsg , a )
857
857
}
@@ -965,15 +965,15 @@ func doNotZero[T Number](val T, a []any) {
965
965
// packages. And, yes, we have tested it. This is fastest way to make it without
966
966
// locks HERE. Only the setting the index is secured with the mutex.
967
967
//
968
- // NOTE that since our TLS [asserterMap] we still continue to use indexing.
968
+ // NOTE that since our GLS [asserterMap] we still continue to use indexing.
969
969
func current () (curAsserter asserter ) {
970
- tlsID := goid ()
970
+ glsID := goid ()
971
971
asserterMap .Rx (func (m map [int ]asserter ) {
972
- aster , found := m [tlsID ]
972
+ aster , found := m [glsID ]
973
973
if found {
974
974
curAsserter = aster
975
975
} else {
976
- // use pkg lvl asserter if asserter is not set
976
+ // use pkg lvl asserter if asserter is not set for gorounine.
977
977
curAsserter = defAsserter [def ]
978
978
}
979
979
})
@@ -1015,11 +1015,12 @@ func SetDefault(i defInd) (old defInd) {
1015
1015
return
1016
1016
}
1017
1017
1018
- // SetAsserter set asserter index for the current thread (Tread Local
1019
- // Storage). That allows us to have multiple different asserter in use in the
1020
- // same app running. Let's say that in some function and its sub-functions want
1021
- // to return plain error messages instead of the panic asserts, they can use
1022
- // following:
1018
+ // SetAsserter set asserter for the current GLS (Gorounine Local Storage). That
1019
+ // allows us to have multiple different [asserter] in use in the same process.
1020
+ //
1021
+ // Let's say that in some function you want to return plain error messages
1022
+ // instead of the panic asserts, you can use following in the top-level
1023
+ // function:
1023
1024
//
1024
1025
// defer assert.SetAsserter(assert.Plain)()
1025
1026
func SetAsserter (i defInd ) func () {
0 commit comments