You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module github.com/flimzy/test
go 1.22.0
require golang.org/x/text v0.15.0
What did you see happen?
A data race:
$ go test -race .
PASS
==================
WARNING: DATA RACE
Write at 0x00c0001fa8b0 by goroutine 8:
golang.org/x/text/internal/colltab.(*Iter).SetInputString()
/home/jonhall/go/pkg/mod/golang.org/x/[email protected]/internal/colltab/iter.go:67 +0x52
golang.org/x/text/collate.(*Collator).CompareString()
/home/jonhall/go/pkg/mod/golang.org/x/[email protected]/collate/collate.go:124 +0x4a
github.com/flimzy/test.TestCollate.gowrap1()
/home/jonhall/src/test/test_test.go:13 +0x49
<snip>
What did you expect to see?
I was not expecting a race.
While it's perhaps reasonable to mutate internal state whe calling a comparison function, it's not at all obvious that it would or should, at least not to someone like me who is unfamiliar with the mechanics of collation logic.
I would like to request that, at minimum, the package is documented to not be concurrency-safe.
As a bonus, making it concurrency-safe would be even better, if feasible.
The text was updated successfully, but these errors were encountered:
In general, the expectation is that most objects with pointer methods aren't concurrency safe unless explicitly documented to be so. E.g. regexp.Regexp.
Go version
1.22.0
Output of
go env
in your module/workspace:What did you do?
go test -race
with this file:And my
go.mod
:What did you see happen?
A data race:
What did you expect to see?
I was not expecting a race.
While it's perhaps reasonable to mutate internal state whe calling a comparison function, it's not at all obvious that it would or should, at least not to someone like me who is unfamiliar with the mechanics of collation logic.
I would like to request that, at minimum, the package is documented to not be concurrency-safe.
As a bonus, making it concurrency-safe would be even better, if feasible.
The text was updated successfully, but these errors were encountered: