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
go/token's FileSet AddFile is:
func (s *FileSet) AddFile(filename string, base, size int) *File
But the "base" parameter is typically from s.Base().
(*FileSet).Base() is protected by a mutex, but one that is locked and unlocked before
AddFile also acquires it.
That means two goroutines can allocate the same base and blow up in
go/parser.Parser.AddFile -> token.FileSet.AddFile.
If FileSet's AddFile's base accepted a negative number to mean "you allocate the
base, from fs.Base()", then it could be under the same lock and the higher-level
race would be removed.
And it wouldn't be changing the API.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: