1
0
mirror of https://github.com/golang/go synced 2024-11-06 04:26:11 -07:00
Commit Graph

1870 Commits

Author SHA1 Message Date
Yasuhiro Matsumoto
ba484b064f cmd/bundle: move down imports of external package
imports should be ordered like

    import (
    	"fmt"

    	"golang.org/x/text"
    )

Change-Id: I000374833de370463d772c2596c7ac6ee5e9725c
Reviewed-on: https://go-review.googlesource.com/23026
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-05-26 02:53:53 +00:00
Monty Taylor
6d483ee832 vcs: Add support for git.openstack.org
Go is being proposed as an officially supported language for elements of
OpenStack:

  https://review.openstack.org/#/c/312267/

As such, repos that exist in OpenStack's git infrastructure
are likely to become places from which people might want to go get
things. Allow optional .git suffixes to allow writing code that
depends on git.openstack.org repos that will work with older go versions
while we wait for this support to roll out.

Change-Id: I1f7be6b7aae63f9c554dbcdbfa46855bcff321df
Reviewed-on: https://go-review.googlesource.com/23362
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 15:53:25 +00:00
Andrew Gerrand
9ae4729fba godoc/proxy: use HTTPS when bouncing through to the playground
Fixes golang/go#15692

Change-Id: I0d0731b249de9399b972c8ee9cf9e0f355d4fcc0
Reviewed-on: https://go-review.googlesource.com/23241
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-19 07:11:34 +00:00
Cezar Sa Espinola
c86fe5956d imports: try importing pkg path from vendor when looking for pkg name
Since CL 17728 goimports was using the file path to try finding packages
inside its /vendor directory. This CL builds upon this previous work to
also consider packages inside /vendor when converting an import path to
a package name.

Change-Id: I173472ac51e3f681d758ec52add60ffc04c62c1a
Reviewed-on: https://go-review.googlesource.com/22020
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-10 17:11:45 +00:00
Robert Griesemer
fbb6674a74 go/gcimporter15: match recent changes to export format
This is a copy&paste fix of the changes in golang.org/cl/22839.

Fixes https://github.com/golang/lint/issues/207 .

Change-Id: I2c4850395c8aa330ea27ad629b21ac21b973ef75
Reviewed-on: https://go-review.googlesource.com/22963
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-10 02:37:36 +00:00
Alan Donovan
3f1f7eeff1 go/gcimporter15: set Pos attribute of decoded types.Objects
BImportData now requires a token.FileSet.
Column numbers are not exported, and are always reported as 1.
Line numbers greater than the limit (currently 64K) are reported as 1.

+ Test that file/line info is correctly preserved for the entire
  standard library.

Change-Id: I80cf370685320240dfb262d36fafd6cdf8569bfb
Reviewed-on: https://go-review.googlesource.com/22788
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-05-09 13:28:09 +00:00
nwidger
2c200eec40 cmd/godoc: Add anchor links to functions, types and methods
Added anchor link beside each function, type and method definition in
godoc's generated HTML.  Anchor links are only shown when the mouse is
hovering over the definition.  The link body is the Unicode PILCROW SIGN
character (&#xb6; HTML entity).

Fixes: golang/go#13748

Change-Id: I645269f6c229f76b2882899e1a7483577877ac30
Reviewed-on: https://go-review.googlesource.com/20246
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-05 16:36:38 +00:00
Francesc Campoy
0b2f4dcf4d tools: fix 'Split called after Scan'
Change-Id: I2dae23440d33fa830107575987805e858e4bf4a7
Reviewed-on: https://go-review.googlesource.com/22749
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-04 16:29:22 +00:00
Robert Griesemer
8dab6f1129 go/gcimporter15: adopt changes from golang.org/cl/22714
Fixes x/tools build.

Change-Id: Ifd958ff1293ec2c4fd971813ae7b199b5d8244fe
Reviewed-on: https://go-review.googlesource.com/22721
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-03 16:15:14 +00:00
Andrew Gerrand
c9a2436076 cmd/godoc: set Strict-Transport-Security header in production
This coerces browsers into enforcing HTTPS-only for golang.org.

Change-Id: I91a4cc64b10b9836ef5623314a3cf22a54033dc2
Reviewed-on: https://go-review.googlesource.com/22673
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-02 17:22:30 +00:00
Andrew Gerrand
0238d429c7 cmd/tip: set Strict-Transport-Security header in production
Change-Id: I33db74025785c802a634f324ad110a4ec5381c1f
Reviewed-on: https://go-review.googlesource.com/22674
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-02 17:21:26 +00:00
Andrew Gerrand
f3109af80d playground: fix share URL
The baseURL is used to construct the target URLs for both /compile
and /share. When I changed it recently, I forgot about the latter case.

Change-Id: Icde617b1cc3d31d98ca4b62e313b9d886253f1cc
Reviewed-on: https://go-review.googlesource.com/22689
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-02 16:10:21 +00:00
Konstantin Shaposhnikov
d4437bf597 imports: add go:generate directive for generating zstdlib.go
Change-Id: I8c54e01799f690819cda746ad5fb7c4d87e769c4
Reviewed-on: https://go-review.googlesource.com/22541
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-29 02:56:15 +00:00
Alan Donovan
686d0ad5b8 go/ssa: reduce set of expected indirect imports
...now that gc's export data records fewer dependencies.

Change-Id: Ie0f68f1f7b0825f6d2c100dfe189be017383db60
Reviewed-on: https://go-review.googlesource.com/22584
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-28 21:42:55 +00:00
Robert Griesemer
c5c16cf68a go/gcimporter: update importer to match latest gc export data changes
Adjustments taken from https://golang.org/cl/22580.

Change-Id: Ic88137b410767bd17e3d6142cec2b5a112df56be
Reviewed-on: https://go-review.googlesource.com/22582
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-28 21:04:03 +00:00
Alan Donovan
14480f21a0 cmd/guru: for determinism, sort referrers output in test
Previously we were sorting only JSON objects, but we must do the same
for plain output too to avoid sporadic failures.

Tested 20 times.

Change-Id: Ic60363b720c2afc91b57864bc93e298f83e85b99
Reviewed-on: https://go-review.googlesource.com/22555
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-28 19:07:35 +00:00
Alan Donovan
56005b4126 go/ssa/interp: add intrinsic for runtime.NumGoroutine
...which is used by $GOROOT/test/goprint.go.

Change-Id: I4626b8fae3f87d9c8dd8cdcd8c05036955a36262
Reviewed-on: https://go-review.googlesource.com/22560
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-28 18:16:55 +00:00
Alan Donovan
50ff896a1c cmd/guru: definition: opt: avoid type checker for qualified identifiers
For a 'definition' query on X in p.X, use special logic to load and
parse package p and find the declaration of package member X, without
using the type checker.  Such queries now typically take under
10ms (faster than godef).

The logic assumes that import "something/p" defines the name p.  If this
assumption is false, p.X could be a selection of a field or method X on
a member p of the same package, defined in another file.
So don't write code like that.

Added missing test of 'definitions'.
JSON tests now sanitize absolute $GOPATH filenames in the output.

Fixes issue #15458

Change-Id: I21e75fcc9372aaedd56851cace444aef205c7a97
Reviewed-on: https://go-review.googlesource.com/22526
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-04-28 17:00:30 +00:00
Konstantin Shaposhnikov
e48e17a0b5 imports: update static stdlib index to go1.6
Change-Id: Ie19594472ec0fa2455a3f1aeac681e74eb3a6b0b
Reviewed-on: https://go-review.googlesource.com/22539
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-28 14:59:03 +00:00
Alan Donovan
0f5f9fcf9a cmd/guru: implements: if selected expr is a value, use its type
...as the basis of the query, instead of reporting an error.

+ test

Change-Id: Ie5defa98cd8dfc8e200e296c2aa02c88893cf9ac
Reviewed-on: https://go-review.googlesource.com/22117
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-04-28 14:33:14 +00:00
Alan Donovan
9ae7e1769c cmd/guru: Emacs: run guru asynchronously using compilation-mode
We define a derived mode of compilation-mode, so that various
names say "guru" instead of "compilation", and use the hooks it
provides to apply our postprocessing incrementally instead of
all at the end.  It's much faster, and works nicely with the
new streaming referrers query.

Compilation mode requires a shell command, not an execve array,
so go-guru--compile-command joins the arguments with spaces.
go-guru--exec has been specialized for JSON mode,
and renamed to go-guru--json.

go-guru--set-scope-if-empty is now done by each mode, to avoid
the NEED-SCOPE parameter to go-guru--exec.

Change-Id: I692b8b28449b7cc17fd6251a152588f9d8b89ebc
Reviewed-on: https://go-review.googlesource.com/21772
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-28 14:21:22 +00:00
Andrew Gerrand
94f857c7cf cmd/tip: bump verison serving tip.golang.org to HEAD
This picks up a recent change to the playground package.

Change-Id: I9b5f0ef9981373274d707014a2c0e2786e9624c0
Reviewed-on: https://go-review.googlesource.com/22538
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-28 01:23:19 +00:00
Andrew Gerrand
1f1b3322f6 playground: hit golang.org/compile endpoint instead of play.golang.org
Not sure why this was originally going via the playground. It needn't.

Change-Id: I40b5886a56ba4b941ff74f4bc325625412d7eaff
Reviewed-on: https://go-review.googlesource.com/22497
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-27 05:26:01 +00:00
Andrew Gerrand
53006ac4c2 cmd/tip: redirect from HTTP to HTTPS; update to Go 1.6
Change-Id: I7b219a991df4f71d068b62a22f69acb123ac31f0
Reviewed-on: https://go-review.googlesource.com/22367
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-27 01:13:02 +00:00
Robert Griesemer
4e3242e000 go/gcimporter: cut off any gc-specific parameter numbering
Matching pending CL https://golang.org/cl/22441/.

Change-Id: I96fab1da7abfeb8f22ce680183649dfa4b84d461
Reviewed-on: https://go-review.googlesource.com/22442
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-25 22:17:50 +00:00
Robert Griesemer
487c81ee33 go/gcimporter15: match https://golang.org/cl/22385
Don't export position info for now. Enabled/disabled with a flag.
The importer recognizes the chosen format automatically.

Change-Id: I055818eb9dba50cc97f40eb92220258a1ddbfbec
Reviewed-on: https://go-review.googlesource.com/22427
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-25 20:08:02 +00:00
Andrew Gerrand
477d3b98e5 godoc: recognize examples with unordered output
A pared down verison of https://golang.org/cl/20458
that is compatible with Go 1.5.

Fixes golang/go#10149

Change-Id: I550b097dc1cd65d0711bdea943f2b0678cfbc5fd
Reviewed-on: https://go-review.googlesource.com/22032
Reviewed-by: Caleb Spare <cespare@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
2016-04-22 02:03:42 +00:00
Alan Donovan
5e468032ea cmd/guru: avoid bug when -scope=""
strings.Split is not your friend.

Change-Id: I829f08f113f3340b2dd865aea47f5759a427f7c4
Reviewed-on: https://go-review.googlesource.com/22116
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-04-18 16:46:08 +00:00
Andrew Gerrand
0c4d9b3099 godoc/dl: remove broken link to old releases
Fxies golang/go#15284

Change-Id: I64db7db801eb8ab89765aeb6ab3f3facad4f21be
Reviewed-on: https://go-review.googlesource.com/22165
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-18 04:04:19 +00:00
Dominik Honnef
3114265539 cmd/guru: emacs: interpret byte offsets correctly
Change-Id: Id506c6c0b3f3c585781bfc38df1b665d507a7c33
Reviewed-on: https://go-review.googlesource.com/22019
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-17 18:15:17 +00:00
Dominik Honnef
837ce23ea3 cmd/guru: emacs: report most specific element in expand-region
Keep the leftmost element when removing duplicates, so that we report
"function call" instead of "expression statement".

Also split go-guru--enclosing into two functions.

Change-Id: Ie325613e292e36dda9558eda54bc7323fbf0bc6d
Reviewed-on: https://go-review.googlesource.com/22132
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-17 13:26:57 +00:00
Hironao OTSUBO
321c6fd171 cmd/stringer: fixed usage line typo
Change-Id: I5852d03c0326d82c13d9e1078f9648ecc695fbbf
Reviewed-on: https://go-review.googlesource.com/22150
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-17 02:19:27 +00:00
Robert Griesemer
764c4ccf44 go/gcimporter15: match https://golang.org/cl/22096/
Read and write position info.

Change-Id: Ibe4a914ff51911bbda656b08f1397132e495ab8a
Reviewed-on: https://go-review.googlesource.com/22098
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-15 16:49:27 +00:00
Simon Jefford
4b9c8b56b8 cmd/godoc: fix multi-paragraph marker rendering
Fixes golang/go#15231

Change-Id: Ia0e00f1eca41dfdd85158feb3fa300df40cfa185
Reviewed-on: https://go-review.googlesource.com/21972
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-14 23:55:41 +00:00
Andrew Gerrand
3868f57059 godoc/static: replace version strings with actual versions
This will allow the source installation instructions to
always show the current version, but only when that version
is a release version.

Fixes golang/go#14371

Change-Id: Ibfad8054f3c75d9320ca94ba5149ab9bf052157e
Reviewed-on: https://go-review.googlesource.com/22056
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-14 23:46:28 +00:00
Robert Griesemer
5da1e91fb2 go/gcimporter15: match https://golang.org/cl/21939/
Plus cleanups from https://golang.org/cl/21963/.

Change-Id: Ifb216081581950f38d73bcb5f22e2ca7acd64f01
Reviewed-on: https://go-review.googlesource.com/21965
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-13 17:25:25 +00:00
Andrew Gerrand
c3291436fa cmd/tip: look for godoc binary under $GOPATH/bin instead of $GOROOT/bin
A recent change to the cmd/go tool made it place godoc in $GOPATH/bin
instead of the special-cased $GOROOT/bin.

Change-Id: If026ff7e3a521ee2aa9b4107585124df108d7124
Reviewed-on: https://go-review.googlesource.com/21951
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-13 03:37:58 +00:00
Dominik Honnef
446a18e709 go/buildutil, cmd/guru: extract overlay context into buildutil
This extracts the overlay context and archive parsing from guru into
buildutil.

At least one tool (gogetdoc) has a vendored copy of this code already,
and more tools implementing the same functionality will follow.

The new code in buildutil is an almost identical copy of the code in
guru (names aside), except for the following changes:

- Instead of reading into a bytes.Buffer, we read directly into a []byte
  of appropriate size

- sameFile first attempts a simple comparison of path.Clean'ed paths.

Change-Id: I97cd978ccc10722e3648e5e10625fa7f1407f202
Reviewed-on: https://go-review.googlesource.com/21805
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-13 01:11:48 +00:00
Dominik Honnef
fb9c7fc43c cmd/guru: emacs: add function for expandiong region
The go-guru-expand-region function uses the "what" query to determine
the enclosing regions. Consecutive calls to go-guru-expand-region will
reuse a cached version of the list.

Change-Id: Ice9ac5540c1b639c6cbdc505866bbab347be1e98
Reviewed-on: https://go-review.googlesource.com/21754
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-13 01:08:39 +00:00
Robert Griesemer
b9ac36caf8 go/gcimporter15: match https://golang.org/cl/21896/
Change-Id: I1cd7a77617658c057c863bd311470f1f22062aee
Reviewed-on: https://go-review.googlesource.com/21900
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-12 19:34:05 +00:00
Alan Donovan
51487f711d x/tools: remove remaining files tagged for Go 1.4
(accidentally omitted from https://go-review.googlesource.com/20810)

Change-Id: Ib6ee4b2e43b6f32c5c0c031910087cc39d5c5d14
Reviewed-on: https://go-review.googlesource.com/21862
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-12 18:58:24 +00:00
Dmitri Shuralyov
d601baae9c go/vcs: apply test style improvements from cmd/go
Apply style improvements to TestFromDir from golang/go@b6cd6d7d32,
in order to keep them in sync.

Check for error when creating a directory, its successful existence is a
precondition for the test to run.

Helps golang/go#11490.

Change-Id: I87054114c84aead96977f603ca3bd9eccfcfbd5e
Reviewed-on: https://go-review.googlesource.com/21795
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-04-12 07:00:54 +00:00
Alan Donovan
2da0720e4f cmd/guru: support streaming plain and -json output
Visible changes:
- "referrers" queries now emit a stream of results,
  so they start appearing quickly even in large queries.
  We no longer report the total number of matches.
- packageReferrers now also uses AfterTypeCheck hook and streaming.
- XML support has been dropped.
- The -format flag has been replaced by -json.

JSON protocol changes:
- The enclosing Result struct has been removed.
- Likewise the 'mode' field (since the caller knows it already)
- "freevars" and "referrers" now emit a stream of objects
  In the case of referrers, the first object has a different from the rest.
- The "referrers" results include the text of the matching line
  (parity with -json=false)

Implementation details:
- the concurrency-safe q.Output function can be called
  many times, each with a queryResult to print.
- fset is no longer saved in Query (cleaner)
- queryResult methods renamed PrintPlain, JSON

Change-Id: I41a4e3f57f266fcf043ece4045bca82c6f6a356f
Reviewed-on: https://go-review.googlesource.com/21397
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-04-11 19:51:55 +00:00
Dmitri Shuralyov
13c24a6d6a go/vcs: report correct directory for 'no version control'
Apply golang/go@b99fdb2a11.

Updates golang/go#6175.
Helps golang/go#11490.

Change-Id: I897bac1bac94b53e950cb5cf5e572d25a7c5996b
Reviewed-on: https://go-review.googlesource.com/21342
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-08 03:23:12 +00:00
Audrey Lim
b75b3f5cd5 x/tools/present: add command line flag to enable presenter notes
Change-Id: I9d4414ce8bafcb13f53361b45774f379bacd886b
Reviewed-on: https://go-review.googlesource.com/21486
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 00:38:29 +00:00
Audrey Lim
52d9c872e3 x/tools/present: parse presenter notes and record them in Section struct
This is the first of a series of changes that add support for
speaker notes to the Go present tool. This is done by displaying
slides with speaker notes on a second window, and synchronizing
both windows.

Updates golang/go#14654

Change-Id: Ic7b158d1e40f9e7e58d01791c88909f5619ce87f
Reviewed-on: https://go-review.googlesource.com/21485
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 00:13:27 +00:00
Robert Griesemer
83f918d66b go/gcimporter15: update gcexporter to match gc export format
Change-Id: Icd84cbef6463ba584a2a29f01b23c7e4542d0101
Reviewed-on: https://go-review.googlesource.com/21618
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-06 22:12:38 +00:00
Alan Donovan
f07cde3d91 refactor/eg: fix build after deletion of x/tools/go/types
Change-Id: Ic8d9c37230b3359a3caa7514c89eae9595f2fb80
Reviewed-on: https://go-review.googlesource.com/21584
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-06 22:02:45 +00:00
Robert Griesemer
adaaa07486 x/tools: delete x/tools/go/types and dependent packages/client files
Per https://groups.google.com/forum/#!topic/golang-announce/qu_rAphYdxY
this change deletes the packages

  go/exact
  go/gccgoimporter
  go/gcimporter
  go/importer
  go/types
  cmd/vet

from the x/tools repo and any files depending on those packages
building against Go 1.4.

x/tools packages depending on any of these libraries must use the
respective versions from the std lib or use vendored versions if
building against 1.4.

Remaining packages may or may not build against Go 1.4 anymore
and will not be supported against 1.4.

Change-Id: I1c655fc30aee49b6c7326ebd4eb1bb0836ac97e0
Reviewed-on: https://go-review.googlesource.com/20810
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-06 21:52:49 +00:00
Andrew Gerrand
fe1488f8ab present: fix misspelled TODO
Change-Id: Id984c4e5c7cde4a5ecf3ae783441fc866d86d404
Reviewed-on: https://go-review.googlesource.com/21527
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-04-06 00:42:05 +00:00