Backport of the go/types-specific changes of:
https://go-review.googlesource.com/#/c/11673/
(from std repo go/types). This will allow running
the go/types tests again in the x/tools repo.
Change-Id: I97d4664d5aed6309e74b571f86f36f8bb4df4fca
Reviewed-on: https://go-review.googlesource.com/12042
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This doesn't fix the race; doing that would require a bit of a redesign.
Since GopherCon is this week, just put in this stop-gap measure for now.
Update golang/go#11534
Change-Id: Ied6c5dd52778534a7a08b5ba3fa15c0352a65646
Reviewed-on: https://go-review.googlesource.com/11886
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
The optional Qualifier function determines what prefix to attach to
package-level names, enabling clients to qualify packages in different
ways, for example, using only the package name instead of its complete
path, or using the locally appropriate name for package given a set of
(possibly renaming) imports.
Prior to this change, clients wanting this behavior had to copy
hundreds of lines of complex printing logic.
Fun fact: (*types.Package).Path and (*types.Package).Name are valid
Qualifier functions.
We provide the RelativeTo helper function to create Qualifiers so that
the old behavior remains a one-liner.
Fixesgolang/go#11133
Change-Id: Ibd63f639c7b3aa1738826d6165f2d810efeb8293
Reviewed-on: https://go-review.googlesource.com/11692
Reviewed-by: Robert Griesemer <gri@golang.org>
Also: make (*Scope).Innermost work for Package scopes.
Change-Id: I9836676e94f95df897101606bed6f29ba46e0f9d
Reviewed-on: https://go-review.googlesource.com/11691
Reviewed-by: Robert Griesemer <gri@golang.org>
since we can't interpret os.Pipe yet.
Change-Id: If27dadc18532274ce97ad7e7557e8614dd15279e
Reviewed-on: https://go-review.googlesource.com/11712
Reviewed-by: Robert Griesemer <gri@golang.org>
Mobile-friendly design overlooked indentation in table of contents
for article table of contents; this change restores indentation.
Change-Id: I9a3013497e1659ebfb657a8fb9374b8ad9b04b16
Reviewed-on: https://go-review.googlesource.com/11582
Reviewed-by: Andrew Gerrand <adg@golang.org>
And in gomvpkg, don't stop just because some packages had errors.
This is inevitable in a large GOPATH tree.
Fixes issue golang/go#10907
Change-Id: I9a60b070228d06d44880202eeef54394e914f5d5
Reviewed-on: https://go-review.googlesource.com/10715
Reviewed-by: Sameer Ajmani <sameer@golang.org>
This change makes golang.org responsive, including a top
bar menu and appropriate font sizing. The result is a
website that looks pleasing and is functional both on
mobile and on desktop. Also added a few print styles so
the site looks great on paper or PDF.
Change-Id: I16ee25ef4afde2002f240aec0804414bfb172a24
Reviewed-on: https://go-review.googlesource.com/9062
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Revert "go/types: fix Eval to use correct file set when evaluating an expression"
This reverts commit d241a1448b.
Change-Id: Ie16c57da2732d8b079108efef100fc956b71f737
Reviewed-on: https://go-review.googlesource.com/11010
Reviewed-by: David Symonds <dsymonds@golang.org>
Scopes now have "extent" information; that is they provide a
range [scope.Pos(), scope.End()) which describes the source
text range covered by the scope. It requires that the incoming
AST has correct position information; also the extent for the
Universe and for package scopes is not set (positions are invalid).
Objects have a new (currently unexported) scopePos position,
which is the position at which the object becomes visible inside
its *Scope.
Scope.LookupParent takes an addition parameter pos. If valid, an
identifier is looked up as if found at position pos. This can be
used to find the object corresponding to an identifier at position
pos after scopes have been completely populated (and thus may
contain the same identifier which may be defined only later in the
source text).
Fixes#9980.
Change-Id: Icb49c44c5c3d4b93c0718ce2a769ec468877709d
Reviewed-on: https://go-review.googlesource.com/10800
Reviewed-by: Alan Donovan <adonovan@google.com>
since they use quick.Check, which requires the unimplemented
(reflect.Value).SetString.
Also:
- Add reflect.Type.{In,NumIn} methods, whose absence
was only the proximate cause of the failed test.
- Delete bodies of reflect.Value methods so that it's obvious a
function that should be intrinsic is missing.
Change-Id: Ib64b8f4953a913f4ead90e376bda70419adb87cb
Reviewed-on: https://go-review.googlesource.com/10796
Reviewed-by: Robert Griesemer <gri@golang.org>
In preparation for removal of types.New.
Change-Id: Ieff0c41cf03351124cea32e9b96075a4801c051f
Reviewed-on: https://go-review.googlesource.com/10775
Reviewed-by: Rob Pike <r@golang.org>
It cleans the string and removes the initial ./, which will cause the
test to fail if . is not in $PATH
Change-Id: Icc216f7ab4887c39ccda93d1c4093ccd03de44bc
Reviewed-on: https://go-review.googlesource.com/10696
Reviewed-by: Robert Griesemer <gri@golang.org>
This is needed to control which files to test in the usual manner.
A followup CL on the main repo will add the flag to the go vet command.
Updates golang/go#10228
Change-Id: I820d3c74657b58de5e92276627368dedf4e2096c
Reviewed-on: https://go-review.googlesource.com/10692
Reviewed-by: Andrew Gerrand <adg@golang.org>
When String() was called on the maximum value of an integer type (eg
255 for uint8) this would cause an integer overflow, which would cause
an index error later in the code.
Fixed by re-arranging the code slightly.
Fixesgolang/go#10563
Change-Id: I9fd016afc5eea22adbc3843f6081091fd50deccf
Reviewed-on: https://go-review.googlesource.com/9255
Reviewed-by: Rob Pike <r@golang.org>
The variable was assigned but not used, as caught by a tool
written by gorden.klaus@gmail.com.
Change-Id: I84ca3d00896287a35561bd122a0cf64212854a86
Reviewed-on: https://go-review.googlesource.com/10610
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
When Stat() or IsDir() return errors, close the file to avoid a leak.
Change-Id: I46d5e34c3443413ca674f2a703d033d945c21efa
Reviewed-on: https://go-review.googlesource.com/10557
Reviewed-by: Minux Ma <minux@golang.org>
And add a TODO.
Change-Id: I51c63b32e9ac4309cdfb8228348a5d528f36a919
Reviewed-on: https://go-review.googlesource.com/10489
Reviewed-by: Robert Griesemer <gri@golang.org>
Match gofmt's behaviour of closing the status buffer. Don't display the
buffer in case of success as we were going to hide it instantly again,
anyway. Also, instead of using delete-window, use
gofmt--kill-error-buffer. gofmt--kill-error-buffer uses quit-window if
there's a window for the buffer, kill-buffer otherwise.
quit-window only deletes the window if it was created explicitly for the
status buffer and if it is still displaying it. This way, we won't close
windows that the user created or repurposed himself.
Additionally, this change ensures that we don't leave a *go-rename*
buffer lying around when gorename succeeded.
Fixesgolang/go#10972.
Change-Id: Id1efb60d399f0062d870e925138aa827e12f3e58
Reviewed-on: https://go-review.googlesource.com/10453
Reviewed-by: Alan Donovan <adonovan@google.com>
This backports an anlogous change made to std repo go/types and
enables running the tests again in a reasonable amount of time.
Change-Id: Ied59f6788b7b180f34c918a3c94d50c892b15f32
Reviewed-on: https://go-review.googlesource.com/10467
Reviewed-by: Alan Donovan <adonovan@google.com>
This change sets ParserMode=AllErrors so that the parser is never
allowed to discard the AST and use a dummy one just because it saw too
many errors.
Also, change (*loader.Program).PathEnclosingInterval so that other
clients that forget to set this flag don't panic while calling
fset.File(f.Pos()).Base() on an ast.File f with no position info.
Change-Id: Ie544f169d367d2aa85426212b27063dc72e36fb1
Reviewed-on: https://go-review.googlesource.com/10290
Reviewed-by: Robert Griesemer <gri@golang.org>