summaryrefslogtreecommitdiff
path: root/src/go/token/position.go
Commit message (Collapse)AuthorAgeFilesLines
* go/token: use fine-grained locking in FileSetAlan Donovan2017-06-141-17/+18
| | | | | | | | | | | | | | | | | Before, all accesses to the lines and infos tables of each File were serialized by the lock of the owning FileSet, causing parsers running in parallel to contend. Now, each File has its own mutex. This fixes a data race in (*File).PositionFor, which used to call f.position then f.unpack without holding the mutex's lock. Fixes golang/go#18348 Change-Id: Iaa5989b2eba88a7fb2e91c1a0a8bc1e7f6497f2b Reviewed-on: https://go-review.googlesource.com/34591 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/token: remove excess parenthesis in NoPos.IsValid() documentationIbrahim AshShohail2017-05-091-1/+1
| | | | | | | | Fixes #20294 Change-Id: I32ac862fe00180210a04103cc94c4d9fef5d1b6c Reviewed-on: https://go-review.googlesource.com/42992 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* go/token: Fix race in FileSet.PositionFor.Jan Mercl2016-08-161-0/+2
| | | | | | | | | | | | | | | | | | | | Methods of FileSet are documented to be safe for concurrent use by multiple goroutines, so FileSet is protected by a mutex and all its methods use it to prevent concurrent mutations. All methods of File that mutate the respective FileSet, including AddLine, do also lock its mutex, but that does not help when PositionFor is invoked concurrently and reads without synchronization what AddLine mutates. The change adds acquiring a RLock around the racy call of File.position and the respective test. Fixes #16548 Change-Id: Iecaaa02630b2532cb29ab555376633ee862315dd Reviewed-on: https://go-review.googlesource.com/25345 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* go/token: document postcondition of SetLinesAlan Donovan2016-05-051-0/+1
| | | | | | Change-Id: Ie163deade396b3e298a93845b9ca4d52333ea82a Reviewed-on: https://go-review.googlesource.com/22831 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: use "reports whether" in place of "returns true if(f)"Josh Bleecher Snyder2015-03-181-3/+3
| | | | | | | | Comment changes only. Change-Id: I56848814564c4aa0988b451df18bebdfc88d6d94 Reviewed-on: https://go-review.googlesource.com/7721 Reviewed-by: Rob Pike <r@golang.org>
* go/token: document that column positions and file offsets are in bytesRobert Griesemer2015-02-231-3/+3
| | | | | | | | Fixes #9948. Change-Id: I7b354fccd5e933eeeb2253a66acec050ebff6e41 Reviewed-on: https://go-review.googlesource.com/5611 Reviewed-by: Alan Donovan <adonovan@google.com>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+485
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.