1
0
mirror of https://github.com/golang/go synced 2024-10-01 07:28:35 -06:00
Commit Graph

2447 Commits

Author SHA1 Message Date
Michael Matloob
ceb18cec46 go/packages: switch fallback implementation to use go list
The go/loader based implementation was too different. Instead
Just call go list twice to get all the dependencies. This immediately
enables more functionality.

Change-Id: I22883492e996133bc61664314318c5e0a9cc10dc
Reviewed-on: https://go-review.googlesource.com/125939
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-07-26 16:53:35 +00:00
Ian Cottrell
475b7a1e12 go/packages: fix the gopackages command
It got broken when we renamed all the modes, and because it is just an
example binary it is not testsed.

Change-Id: Ia6608af574d0abebb4fe0d967e1bed88af6563bd
Reviewed-on: https://go-review.googlesource.com/125937
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-25 23:55:34 +00:00
Ian Cottrell
b1e4acd68a go/packages: alter the internal api to go list
This separates the go list specific behavior from the generalised go/packages
loading behaviour, to enable alternate build system back ends.

Change-Id: I07e7649f8f2afc7470a3ee3d0d743cbbcc6f713e
Reviewed-on: https://go-review.googlesource.com/125715
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-25 20:44:53 +00:00
Brad Fitzpatrick
65cc56d756 godoc: fix tests on Go 1.9
Updates golang/go#11811
Updates golang/go#26531

Change-Id: I9cc7daf551b76c3f06b9dd827c5733513c06895e
Reviewed-on: https://go-review.googlesource.com/125816
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-25 19:11:30 +00:00
Ian Cottrell
14e571052b go/packages: fix internal go list function signatures
After a discussion in cl/125535 this is a proposal to clean up some
internal function signatures that were becomming unwieldy.

Change-Id: I37a9e525ab18dface9ea9fb0b0ec68ac942ee632
Reviewed-on: https://go-review.googlesource.com/125659
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-25 19:03:22 +00:00
Agniva De Sarker
4d8a0ac9f6 cmd/godoc: fix TestWeb for versions < 1.11
The test was looking for strings found in specific Go versions
without checking for the actual Go version running the test.

Used ReleaseTags to check whether the current go version should
execute a test or not.

P.S. The version info is inferred from the binary running the test.
But the test builds godoc using the "go" binary in $PATH. In case
one is testing different go versions, please ensure to run tests
by changing the $PATH variable to point to different go versions,
rather than using a custom go binary in a different path.

Fixes golang/go#26531

Change-Id: I16dda81518021e865e79c9c29fc2d9e8a83e7057
Reviewed-on: https://go-review.googlesource.com/125755
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-25 15:26:38 +00:00
Michael Matloob
526516e9c4 go/packages: support pre go1.10.4 using go/loader
If go list fails because it doesn't support the new flags added
for Go 1.11 (which will be also released in Go 1.10.4) try again
using the Loader to approximate the packages requested.

This implementation is incomplete. It will never support test packages
because of the two phase test loading process of the Loader. It
also doesn't reliably have access to export data so it will
always do an upgraded whole-program query. But we'll try to get
the best level of support we can for the go/packages interface
given the limitations of the loader.

Once Go 1.12 is released, we'll delete this support. By then, most
Go users should have at least switched to Go 1.10.4.

Change-Id: I5248e20980032695a86b052caa9ff368ecf7b142
Reviewed-on: https://go-review.googlesource.com/125616
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-07-25 00:20:46 +00:00
Ian Cottrell
214274eeeb go/packages: changes to the API per CL 125305
Collapse the main entry points to the single Load function.
Make public the Mode enumeration in the Config.
Add a lowest level mode that does not do the import graph.
Remove PkgPath.
Remove the DisableCgo option.
Rename some fields of Package:
  Srcs -> GoFiles
  OtherSrcs -> OtherFiles
  Type -> Types
  Files -> Syntax
  Info -> TypesInfo
delete the All function

Change-Id: I54e5dc3ca5cb0b7e33fe6aa6f70cc66e18ea8cac
Reviewed-on: https://go-review.googlesource.com/125535
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-25 00:10:29 +00:00
Ian Cottrell
ded554d068 go/packages: splitting the scratch fields out of Package
This makes Package a struct we can re-use in other places/algorithms.

Change-Id: I2e095a624bf44223319ba1ea3d60deb727b38f81
Reviewed-on: https://go-review.googlesource.com/124855
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-23 20:42:46 +00:00
Russ Cox
96ee42108a go/packages: revise documentation
I made a pass through the documentation trying to simplify
and make it more accessible to readers who are unfamiliar
with all the ins and outs of the implementation.

I also added TODOs about things I don't understand
and names that we should think about changing.

Change-Id: I633316bd407f3360eb8a683bc8d85fba93ca381e
Reviewed-on: https://go-review.googlesource.com/125305
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-23 18:30:23 +00:00
Gustav Westling
60ffea201e godoc: correctly parse packages with digits in the package name
Fixes golang/go#26514

Change-Id: I4540737425c225c0f0c6104b5b3524621d2b0c6f
GitHub-Last-Rev: 9d5fefb6ed31579b723293c7f43fcf677ac4cddb
GitHub-Pull-Request: golang/tools#41
Reviewed-on: https://go-review.googlesource.com/125335
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-22 15:00:05 +00:00
Brad Fitzpatrick
99195f4d4f godoc/dl: also serve go-import meta tags at golang.org/dl for cmd/go
Updates golang/go#23223

Change-Id: Iacecbb5e095fd3d6acb3f8e1fb238db63d1e0b6d
Reviewed-on: https://go-review.googlesource.com/125195
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-20 05:57:21 +00:00
Brad Fitzpatrick
827f47db85 godoc/dl: add meta tags for go get golang.org/dl/go1.N
Updates golang/go#23223

Change-Id: I628cea181d3a0e6bb25fdd98e098581aa222e049
Reviewed-on: https://go-review.googlesource.com/123679
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-20 03:34:01 +00:00
Andrew Bonventre
42aedba1e0 godoc/dl: update download link from /x/build/version to /dl
Change-Id: Id2baaa87ab23e27ce5018271c8bb4e73750fb437
Reviewed-on: https://go-review.googlesource.com/125137
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-20 03:31:16 +00:00
Jim Minter
4735f53fb3 cmd/goyacc: append trailing newline to text "Code generated by goyacc"
Fixes golang/go#26478

Change-Id: Ieaf7dcaf639b277555580964acfff034393284e2
GitHub-Last-Rev: f2a6ab2a513d4938cda62f46de7f5314714b5325
GitHub-Pull-Request: golang/tools#39
Reviewed-on: https://go-review.googlesource.com/124995
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-19 18:26:00 +00:00
Michael Matloob
54f9f5980a go/packages: remove Package.IsTest field
We have not yet settled on the meaning of Package.IsTest, and more
deeply which packages are test and which are non test packages.

This change will remove Package.IsTest in the meantime to avoid
confusion. We may later add a boolean or some other way to distinguish
test and non-test packages.

Change-Id: If6b128f7914009fdd42b8bc3de3bff73c8f006cd
Reviewed-on: https://go-review.googlesource.com/124388
Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-19 17:37:31 +00:00
Brad Fitzpatrick
32950ab3be godoc: add version info for struct fields
Follow-up to CL 85396, which only did types, funcs, and methods.

This adds version info to struct fields (in the form of small
comments) if the struct field's version is different from the struct
itself, to minimize how often this fires.

Updates golang/go#5778

Change-Id: I34d60326cbef88c108d5c4ca487eeb98b039b16e
Reviewed-on: https://go-review.googlesource.com/124495
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Devon O'Dell <dhobsd@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-17 23:22:00 +00:00
Devon H. O'Dell
57f659e14d godoc: show version information for stdlib
This change reads $GOROOT/api/go1.*.txt when godoc starts and caches
information about which versions of Go introduce functions, types, and
methods. This information is displayed currently only in HTML output.
Functions, types, and methods introduced as part of Go 1 are not
annotated, as their presence at that version is implied.

This change does not address constants or variables, and completely
ignores the syscall package. The former are future work, the latter is
likely an exercise in futility. In all cases, this is because the story
around displaying the version information is not well developed.

Fixes golang/go#5778

Change-Id: Ieb3cc0da7b18e195bc9c443f14fd8a82e8b2bbf8
Reviewed-on: https://go-review.googlesource.com/85396
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Devon O'Dell <dhobsd@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-17 18:09:30 +00:00
Michael Matloob
d74aaa1f57 go/packages: Options.{Dir,Env} pass-through
This change adds optional Dir string and Env []string options
that are passed through to the build system's metadata query.
As with exec.Cmd, the defaults are inherited from the parent
process.

Options.GOPATH is gone. If the client needs to override
GOPATH, they must use Env, but typically the inherited environment
is correct.

The tests not longer use os.Chdir.

We now guarantee that Package.Srcs are absolute file names.

Added test for Options.Dir and relative patterns.

This is a copy of golang.org/cl/123777, which had a merge conflict.

Change-Id: I301724581f3d8c712ea78fa5ab5cabd909940dca
Reviewed-on: https://go-review.googlesource.com/123777
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-17 15:06:01 +00:00
Brad Fitzpatrick
fd2d2c45eb go/packages: fix/skip some tests making build.golang.org red
Updates golang/go#26387

Change-Id: I5d91f3747b4f17186813d830f24aa510f5cf0060
Reviewed-on: https://go-review.googlesource.com/123957
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-07-14 20:55:45 +00:00
Alan Donovan
18e9dfbf20 go/packages: add Option.Tests bool, which affects pattern expansion
In the go build system, test packages and executables do not have a
name distinct from the package under test; they are implied, so
"go test fmt" means build those packages but "go build fmt" does not.

This change adds a Tests boolean option to indicate that implied
tests are desired during pattern expansion.
It has no effect on build systems that have explicit names
for tests, such as Blaze/Bazel.

The gopackages diagnostic tool now has a -test flag.

Change-Id: I424f343958c4286539e518d5f30067da19a57f3b
Reviewed-on: https://go-review.googlesource.com/123775
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-13 17:38:36 +00:00
Alan Donovan
9d3ae49c73 go/packages: report a distinguished ErrGoTooOld error for older go commands
We should add support for older go commands using the multiple-calls
approach of earlier drafts of go/packages.

Also, tag tests for go1.11 to make 1.10 builder happy.

Change-Id: Ia04979528af25cbcd4b4fa5b21cb91d014d530c1
Reviewed-on: https://go-review.googlesource.com/123756
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-13 17:38:21 +00:00
Alan Donovan
2087f8c107 go/packages: remove POSIX filename assumption from test
Change-Id: If1aac9f109b05897b21a2f27a4050fbee2cc2d2e
Reviewed-on: https://go-review.googlesource.com/123357
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-11 20:34:38 +00:00
Alan Donovan
9622293277 go/packages: a new Go package loader for go, vgo and other build systems
This package defines a new API for applications that need information
about Go packages, such as their source files, tests, dependencies,
and (optionally) typed syntax trees. It is intended to replace both
go/build and golang.org/x/tools/go/loader with an API that is simpler
yet supports a range of build systems including 'go build', vgo,
Bazel, and Blaze.

This CL contains the API, the "go list"-based implementation, and some
basic tests. More tests, more features as described in doc.go, and
implementations for bazel and blaze will follow.

Read doc.go for orientation and a list of open questions.

Change-Id: Ib39f15b5e4e2f854553e7185fec5cf135641ffb0
Reviewed-on: https://go-review.googlesource.com/116359
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-07-11 20:11:18 +00:00
Rob Pike
18f0b668f1 cmd/stringer: add a -tags flag that supports build tags
This is reapplying CL121995 after rolling back the change to the importing
methods. There is still a need for a flag to control tags.
The original CL decription:

The feature has been requested but, like build tags in general,
only works in a directory, not when files are specified explicitly.
Unlike the build tools, report when the feature is misused like this
to avoid confusion.

Fixes golang/go#9449

Change-Id: I732627d5f2e6323367e3bdd5de746923868890a9
Reviewed-on: https://go-review.googlesource.com/122537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-10 05:22:40 +00:00
LE Manh Cuong
8cb83b71b4 imports: fix lost line between package and import statement
Fixes golang/go#26290

Change-Id: Ide797a46bf1d0d6070940fb5b9db3e76502bc528
Reviewed-on: https://go-review.googlesource.com/122736
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-10 02:38:27 +00:00
LE Manh Cuong
d600f31f81 imports: fix unexpected blank line after package comment
The fix in golang/go#23709 introduced a separate bug where extra blank
lines were sometimes inserted. This fixes that newly introduced bug.

Fixes golang/go#26246

Change-Id: I78131cc1d01ae246922ed9e4336ebb31d1c6cfa1
Reviewed-on: https://go-review.googlesource.com/122538
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 17:31:08 +00:00
Russ Cox
893c2b1ff5 imports: assume import x/y/v2 is package y
This will be true in general for Go modules, so it's the right fallback.
Note that if the package can be found in GOPATH, the code still
uses the actual package name from GOPATH, so this only changes
the fallback path. The fallback path is what currently executes
when using modules (because they are not in GOPATH).

Change-Id: I3d48517583eae9431e139371d363ce354c89340a
Reviewed-on: https://go-review.googlesource.com/122616
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 16:22:11 +00:00
Russ Cox
ee8f72c720 imports: avoid src/v and src/mod again
This time for real.

Change-Id: I480fd6e4aa591efaf8380e86f5447b8c2bc28cda
Reviewed-on: https://go-review.googlesource.com/122615
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 16:22:07 +00:00
Rob Pike
e2be0f7276 cmd/goyacc: include arguments in DO NOT EDIT marker
A follow-on to CL122095, which normalized the marker but
did not include the arguments.

Output now looks like this:

	// Code generated by goyacc -o expr.go -p expr expr.y. DO NOT EDIT.

Change-Id: I20577ea90943516f45478d778353b5bd2f485dfa
Reviewed-on: https://go-review.googlesource.com/122540
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 04:37:16 +00:00
Rob Pike
827133af57 cmd/stringer: revert back to source importer
Roll back my two recent changes. Stringer is now very slow again,
but works in most use cases.

My git foo is insufficient to do this as a revert, but it is a by-hand
reversion of CLs

	https://go-review.googlesource.com/121884
	https://go-review.googlesource.com/121995

See the issue for a long conversation about the general problem.

Update golang/go#10249
Update golang/go#25650

Change-Id: I7b6ce352a4c7ebf0977883509e9d7189aaac1251
Reviewed-on: https://go-review.googlesource.com/122535
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-07 07:48:14 +00:00
Agniva De Sarker
435878328f cmd/godoc,cmd/tip: enable HSTS preload
Add the includeSubDomains directive to meet the requirements
for being added to the preload list described at https://hstspreload.org/.

Updates golang/go#26162

Change-Id: I415775aa523bcef3a52f1853de033f343b914e83
Reviewed-on: https://go-review.googlesource.com/122175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-06 16:21:24 +00:00
Jonathan Pentecost
16f8f9bb72 cmd/goyacc: add header to generated go output file
Add "// Code generated by goyacc. DO NOT EDIT." to the top of the
generated go output file.

Fixes golang/go#26158

Change-Id: I5dd66af9cd8ccccd27440886c55cd604686472e3
Reviewed-on: https://go-review.googlesource.com/122095
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2018-07-05 09:00:07 +00:00
Rob Pike
75d2ffb453 stringer: add a -tags flag that supports build tags
The feature has been requested but, like build tags in general,
only works in a directory, not when files are specified explicitly.
Unlike the build tools, report when the feature is misused like this
to avoid confusion.

Fixes golang/go#9449

Change-Id: I079d363c5eeb5bc647fd2f0f3d88d28d630644d8
Reviewed-on: https://go-review.googlesource.com/121995
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-04 00:06:24 +00:00
Rob Pike
ffe8890671 cmd/stringer: revert CL 40403
Revert "cmd/stringer: use source importer when available"

This reverts CL 40403.

The idea is to avoid type-checking and use just parsing, which should be
enough for stringer.

Separately reopening golang/go#10249 because the original change closed that issue,
but the change is itself causing other problems as described in the discussion
at golang/go#25650.

This reversion restores the old behavior of stringer and will be followed
with other fixes if they can be worked out.

Change-Id: I8404d78da08043ede1a36b0e135a3fc7fdf6728d
Reviewed-on: https://go-review.googlesource.com/121884
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-03 00:36:02 +00:00
LE Manh Cuong
b23eb6252f imports: fixup comments on import lines correctly
The current implementation uses the added import specs EndPos to fixup
the comments position after import specs is sorted. If two or more
import specs have the same EndPos, a comment associated with one of them
is always added to the last import spec.

This commit uses the current import spec position to compute new
position for next import spec. So there is never two or more specs have
the same EndPos.

Fixes golang/go#23709

Change-Id: I60ace9431d871e94a2b3d90892aa80d0671aeea0
Reviewed-on: https://go-review.googlesource.com/121878
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-02 20:27:37 +00:00
Brad Fitzpatrick
1c99e1239a godoc: default to GOOS/GOARCH js/wasm when rendering syscall/js docs
Otherwise it was just blank. With this CL, this URL should start rendering docs:

   https://tip.golang.org/pkg/syscall/js/

Tested locally.

Change-Id: I2d9b7286f374e9372be372987bb5d12ce5044ce9
Reviewed-on: https://go-review.googlesource.com/121315
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-28 16:39:57 +00:00
Alan Donovan
16699b2d33 go/gcexportdata: add -package flag to diagnostic tool
...to show information about indirectly mentioned packages.

Change-Id: Ib74b56493861bf41d9720760e76ace186efae2ea
Reviewed-on: https://go-review.googlesource.com/121195
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-27 17:17:06 +00:00
Robert Griesemer
56e9b8e653 go/internal/gcimporter,gccgoimporter: use types.NewInterfaceType
https://go-review.googlesource.com/c/go/+/120875 changed the name
of types.NewInterface2 to NewInterfaceType. Adjust x/tools code to
match new API.

For golang/go#25301.

Change-Id: I21e13566f7c88591a16ce461cb4cce8901980b05
Reviewed-on: https://go-review.googlesource.com/120895
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-26 17:42:40 +00:00
Agniva De Sarker
3c1bb8b785 godoc: accept scanner.RawString too during EBNF parsing
Commit c8915a0696 changed the text/scanner
package to return a scanner.RawString (rather than a scanner.String) token
for raw string literals. This broke the EBNF parser which didn't look
for scanner.RawString.

Updated the EBNF parser code to reflect that change.

Fixes golang/go#25986

Change-Id: Ib9c133a7c357dd750a4038d2ed39be86a245995c
Reviewed-on: https://go-review.googlesource.com/120659
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-25 04:25:21 +00:00
Austin Clements
25b95b4822 go/ssa: fix some incorrect comments
Change-Id: I8aa4780e0fa4a182678f1d34b247ab203e906144
Reviewed-on: https://go-review.googlesource.com/119915
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-06-20 14:00:53 +00:00
David Symonds
fcb3cb6c24 go/vcs: match go-import package prefixes by slash
This is related to golang/go#15947.

This ports https://golang.org/cl/23732 (June 2016)
from cmd/go to this repository.

Change-Id: I9960556bd19775b433d4eecc0ecca3f09ce1368b
Reviewed-on: https://go-review.googlesource.com/119935
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-20 03:09:55 +00:00
Alan Donovan
53440098a4 godoc/static: resolve merge conflict, committed in error
Change-Id: Ica50edbae03eb1c6efad702841b926ffaf1c98ec
Reviewed-on: https://go-review.googlesource.com/119476
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-06-18 17:10:13 +00:00
Alan Donovan
e10d6c9a84 godoc/static: use a stable quote function
Printf(%q) aka strconv.AppendQuote depends on the Unicode tables du
jour, which means gen_test breaks after a Go release in which Unicode
evolves. This change uses a very dumb quotation function that emits
only ASCII and is independent of the Go release.

Perhaps an even better fix would have been to parse the generated file.

Change-Id: I197942f1c36a8b53d6a37be4bb2b1e63a208f7e2
Reviewed-on: https://go-review.googlesource.com/119157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-18 16:36:09 +00:00
Russ Cox
c06a8d8ed1 imports: skip $GOPATH/src/v and $GOPATH/src/mod
These are both vgo module cache locations (originally v, soon to be mod).
Vgo dumps a lot of code into these directories.
If goimports walks in there, it takes forever.

Change-Id: I667b0a4979bf6a6b71c3651d25ec29777ff15301
Reviewed-on: https://go-review.googlesource.com/119337
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-17 21:38:49 +00:00
Agniva De Sarker
465e6f3992 godoc: add link to expand/close all examples
Fixes golang/go#3081

Change-Id: I096b22691a08d72b88dbe925e17893d24ba3c992
Reviewed-on: https://go-review.googlesource.com/118935
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-15 19:57:36 +00:00
Paul Jolly
c6269430a5 refactor/rename: allow Force to make edits within autogenerated files.
Currently, as documented, gorename fails if it would cause an edit to an
autogenerated file:

- detect and reject edits to autogenerated files (cgo, protobufs)

There are times when refactoring code where such an edit is necessary.
This CL enables such edits if Force is set (which corresponds to
gorename -force).

Change-Id: If21249ae50d61fb5b59ee6e1ecf7157aaae0260a
Reviewed-on: https://go-review.googlesource.com/118975
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-06-14 20:28:06 +00:00
Alan Donovan
903a227b9b godoc/static: mimic the pre-1.10 behavior of strconv.Quote
Thanks to iant for identifying the root cause.

Tested with go1.9 and go1.10.

Fixes golang/go#25880

Change-Id: Ibc3a2aadd92c1e512cf6c537134ee085398e8e6c
Reviewed-on: https://go-review.googlesource.com/118955
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 19:21:16 +00:00
Alan Donovan
49ce10d933 godoc/static: suppress gen_test on go1.9
Either string quotation or Go formatting has since changed.
Will investigate later, but this fixes the dashboard for now.

Change-Id: Ieab3800fc2c24ba86026d25dea12853131c04948
Reviewed-on: https://go-review.googlesource.com/118715
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-06-14 18:36:27 +00:00
Robert Griesemer
c995a08888 go/internal/gcimporter: move 1.11 specific tests out of non-1.11 builds (fix build)
TBR=adonovan

The tests TestImportedTypes and TestIssue25301 are dependent on many
1.11-specific bug fixes that went into go/types. Just move them out
of non-1.11 builds.

While doing so, also extended the set of test cases run by
TestImportedTypes (now matching the corresponding tests cases
in the std lib).

This also makes it again unnecessary to factor out the embeddedType
function into build-specific versions. Removed again.

For https://github.com/golang/lint/issues/402.

Change-Id: I45eb8c3d1dcca7b392f14a7660bc1599a44a0d41
Reviewed-on: https://go-review.googlesource.com/118567
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-06-13 19:12:07 +00:00