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

2046 Commits

Author SHA1 Message Date
Kevin Burke
0a14ca4e16 godoc: don't select line numbers when highlighting source code
CSS3 introduces the user-select property, which you can use to prevent snippets
of text from being highlighted. This is also the technique used by Github to
avoid highlighting line numbers when highlighting source code.

For more information, see:

https://developer.mozilla.org/en-US/docs/Web/CSS/user-select
https://www.w3.org/TR/1999/WD-css3-userint-19990916#user-select

Fixes golang/go#18279

Change-Id: Ia5eb68d5a042d6ee2a1c8e7bbad753a35de5c487
Reviewed-on: https://go-review.googlesource.com/34278
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-12-12 20:17:32 +00:00
Kevin Burke
7932c3d4c8 godoc: Regenerate static/static.go
Picks up changes made in previous commits.

Change-Id: I8edc9e0a512e4d687c471274faaa06e0b40ea657
Reviewed-on: https://go-review.googlesource.com/34283
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-12 20:16:38 +00:00
Brad Fitzpatrick
7d72743fce playground/socket: deflake test, remove sleep
Fixes golang/go#18275

Change-Id: Iedb0a21a3fe0b383a2e51fc92076d7fd005d71e6
Reviewed-on: https://go-review.googlesource.com/34277
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-12-11 02:33:14 +00:00
Brad Fitzpatrick
a888bfdffa go/loader: fix broken tests after context removal from testing package
Updates golang/go#11811
Updates golang/go#18199

Change-Id: I2ce4615653034563a64b9c126651d2a6ce2aef50
Reviewed-on: https://go-review.googlesource.com/34274
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2016-12-10 02:42:22 +00:00
Alan Donovan
3d92dd6003 go/internal/gccgoimporter: handle conversions in exported const values
Same as https://go-review.googlesource.com/c/33412/ in the standard library.

Fixes #17981.

Change-Id: Iaf47872840a4456d824ed5d7b3eda205c043e4cf
Reviewed-on: https://go-review.googlesource.com/34110
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-12-07 20:12:13 +00:00
Rebecca Stambler
99be5a0b85 go/buildutil, cmd/guru: resolve symlinks in filenames through build.Context
Resolve symlinks in source directories (GOPATH, GOROOT, etc.) and source
files in order to find correct package. All I/O performed through
build.Context. Also add minor fix to guru unit tests in order to pass on
Windows.

Change-Id: Ie6134b9cd74eb7386e1d93603eb37c8e44b083b8
Reviewed-on: https://go-review.googlesource.com/33924
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-06 21:45:43 +00:00
Rebecca Stambler
4073e786f5 cmd/guru: avoid testing symlinks on OSes that do not support them
Add condition to prevent unit tests from checking cases with symlinks on
Windows and Plan 9.

Change-Id: Idc41db94a04a0daab556a26390db3f75ded7be73
Reviewed-on: https://go-review.googlesource.com/33923
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-06 20:51:22 +00:00
Rebecca Stambler
ae1141fc8b Revert "go/buildutil: handle symlinks in filenames"
Reason: ContainingPackage should do all I/O through build.Context.

This reverts commit 3a9a2cbbc4.

Change-Id: I3897d8da5026ddc470989e3f239540286e89df4d
Reviewed-on: https://go-review.googlesource.com/33922
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-05 22:44:39 +00:00
Rebecca Stambler
07e766bf81 Revert "go/buildutil, cmd/guru: fix tests for symlinks in guru and gorename to account for windows."
Reason: ContainingPackage must do all I/O through build.Context.

This reverts commit c945ee3be4.

Change-Id: I625410bc754ea2d150be097bf424de2be42acde4
Reviewed-on: https://go-review.googlesource.com/33921
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-05 22:43:53 +00:00
Rebecca Stambler
c945ee3be4 go/buildutil, cmd/guru: fix tests for symlinks in guru and gorename to account for windows
Restructure tests to account for possibility of being run on Windows
(which doesn't handle symlinks).

Change-Id: I428db26c9a1aad337d8972baa2b71468be3a2e58
Reviewed-on: https://go-review.googlesource.com/33920
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-05 21:18:37 +00:00
Rebecca Stambler
3a9a2cbbc4 go/buildutil: handle symlinks in filenames
Resolve symlinks in source directories (GOPATH, GOROOT, etc.) and source
files in order to find correct package.

Fixes golang/go#16219

Change-Id: I6fae14908827d5ebac55dfe455eaf616f71f8767
Reviewed-on: https://go-review.googlesource.com/33919
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-05 20:02:40 +00:00
Zac Bergquist
8462b1669f go/buildutil: fix doc reference
Fix reference to OverlayContext in the doc for
ParseOverlayArchive.

Change-Id: I0b1db478489764fa309cb2e2f788865ac7ff71bb
Reviewed-on: https://go-review.googlesource.com/33916
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-05 17:11:22 +00:00
Rebecca Stambler
366e27042d cmd/guru: handle source file aliasing gracefully
Resolve symlinks in GOPATH or source file path in order to find correct package.

Fixes golang/go#17515

Change-Id: Iaf7e85578fce040b329427ce6f51948a69e57a39
Reviewed-on: https://go-review.googlesource.com/33858
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-02 22:01:05 +00:00
Russ Cox
e04df2157a present: allow markup inside punctuation connected to other text
This allows markup bracketed by punctuation even when the
punctuation has text on the other side, like in:

- Markup—_especially_italic_text_—can easily be overused.
- We want to increase `go`vet`'s usage.

Change-Id: I0c6ca790f23f705d8c8ba8a225c0280b916ebb6c
Reviewed-on: https://go-review.googlesource.com/33662
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-12-01 05:16:25 +00:00
Brad Fitzpatrick
e5f9a3deee godoc: update struct field anchor code
Now without regexps and allocations.

And also match comments like:

    // Foo, if non-nil, ...

The comma confused the old pattern.

Updates golang/go#16753

Change-Id: I9016ee7b5933ea343950a39989952804c74a598b
Reviewed-on: https://go-review.googlesource.com/33755
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-12-01 02:33:17 +00:00
Brad Fitzpatrick
0f86c627e2 cmd/godoc: optional ACME autocert support
If built with the "autocert" build tag, use
golang.org/x/crypto/autocert and for automatic TLS certs.

This will be used for https://beta.golang.org/ running on GCE.

Change-Id: Id0e385796a25d663708ea9bb65c45cb1471dd526
Reviewed-on: https://go-review.googlesource.com/33751
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-11-30 23:52:24 +00:00
Brad Fitzpatrick
0f65b31aee godoc: make struct fields linkable in HTML mode
This adds <span id="StructName.FieldName"> elements around
field names, starting at the comment if present, so people
can link to /pkg/somepkg/#SomeStruct.SomeField.

Fixes golang/go#16753

Change-Id: I4a8b30605d18e9e33e3d42f273a95067ac491438
Reviewed-on: https://go-review.googlesource.com/33690
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-30 23:29:37 +00:00
Alan Donovan
34fe8ce027 go/gcexportdata: better error when reading exportdata directly from archive
Change-Id: Iaa6fe8a33bee852be4e2414c6db7ca5df17006b6
Reviewed-on: https://go-review.googlesource.com/33715
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-30 19:52:27 +00:00
Brad Fitzpatrick
b66e054640 Revert "refactor/eg: remove vendor prefix from imported packages"
This reverts commit c060f04f93.

Reason for revert: breaks the build. Nobody ran tests.

Change-Id: I981101eb503e8cebd6f7b5640299d106ca733b33
Reviewed-on: https://go-review.googlesource.com/33674
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-30 00:13:03 +00:00
Zac Bergquist
cbfb669053 refactor/rename: perform renaming in doc comments
Attempt to update doc comments when renaming an identifier.
This reduces the amount of manual steps that need to be taken
when using gorename.

All occurrences of the old identifier are updated in the doc.
The update is done  using a regex to ensure that we replace
whole word matches only.

Fixes golang/go#17994

Change-Id: I4265021b5b34cf7d70bf43ad6ceee74ec132f185
Reviewed-on: https://go-review.googlesource.com/33452
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-29 19:07:26 +00:00
Russ Cox
955e2aeb12 cmd/present: fix indentation in template
No semantic change.
Pointed out by Dmitri Shuralyov on CL 33578.

Change-Id: Ic67f41e8dde8fc9bf624c98307a89bbe1f10e7f7
Reviewed-on: https://go-review.googlesource.com/33659
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-29 18:43:27 +00:00
Russ Cox
76b6c242fb cmd/tip: update talks rev to pick up CL 33578
Change-Id: I5161f7ee490391a71a3c9a00017b2449705fcb7a
Reviewed-on: https://go-review.googlesource.com/33655
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-29 03:26:09 +00:00
Russ Cox
f19f04f549 cmd/present: adjust article presentation
* Give the article title a larger, heavier font than any heading.
  It was strange that the title was 20px regular while the
  h1 section headings were 24px.

* Move the author attribution to the top of the page.
  Author at the bottom, like a signature, may make sense for blog posts,
  but I think it makes less sense for articles.

* Fix the spacing around author lines. Each author line is a <p>
  and the intent seemed to be to cut the vertical space between them
  but that wasn't working.

* Give the table of contents a title, to make clearer what it is.
  Do not show table of contents in printouts.

Change-Id: Iee940ca7697015281fc057750f5db56f70393836
Reviewed-on: https://go-review.googlesource.com/33578
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-29 02:21:02 +00:00
Chris Broadfoot
c97d1a2623 godoc: add on-hover permalink anchors across the site
We already have anchors for godoc types and functions. Add them for
every heading (and "dl") on every other page on the site.

Change-Id: Ibad77f04442e48dd5a41de759010625f89b48604
Reviewed-on: https://go-review.googlesource.com/33641
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-29 00:47:29 +00:00
Alan Donovan
6c803ab014 go/loader: resolve imports in "created" packages w.r.t. parent dir not cwd
Fixes golang/go#16580

Change-Id: Id891f40659257eac9dbb0d70dae17f725e911f9b
Reviewed-on: https://go-review.googlesource.com/33589
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-28 22:26:25 +00:00
Rhys Hiltner
c060f04f93 refactor/eg: remove vendor prefix from imported packages
For package paths that include a "vendor" segment, use only the
portion of the path that comes after the final "vendor" segment, as
is done by the imports package.

Fixes golang/go#17247

Change-Id: Ic83c4662cfddd1a696c206494b3a869e8c7dff5c
Reviewed-on: https://go-review.googlesource.com/29851
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-28 19:57:48 +00:00
Jordan Lewis
ebf631f917 cmd/goyacc: quadruple the max states and actions
This commit quadruples the maximum number of states and the size of the
action table to allow for larger grammars.

Fixes golang/go#11517

Change-Id: Ieb64efa8e3402ae1a5a9190710f98a44195ecd1b
Reviewed-on: https://go-review.googlesource.com/33585
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-28 18:37:26 +00:00
Alan Donovan
574d60b05a refactor/rename: skip TestDiff on plan9, whose diff has no -u
Change-Id: I372591ad3f2804dcd20f0ab3b5a91ddda762cba8
Reviewed-on: https://go-review.googlesource.com/33586
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-28 18:25:41 +00:00
Alan Donovan
89662b06bc go/ssa/interp: add several intrinsics for Darwin
Also: drop all pretense of support for platforms other than darwin and linux.
This package is just a test of go/ssa, not a portable interpreter, and these
are the only platforms to which I have easy access.

Builds on: freebsd darwin plan9 linux windows

Change-Id: I965abc67b1280d33e933b83607a4372d65e070cf
Reviewed-on: https://go-review.googlesource.com/33163
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-28 17:49:04 +00:00
Alan Donovan
167995c67f go/ssa: avoid no-arg println(), for gccgo compatibility
Change-Id: I5f789ae492ff0f0ad62d89e3ae762ece6c867d20
Reviewed-on: https://go-review.googlesource.com/33573
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-23 22:44:20 +00:00
Luigi Riefolo
a829d47117 cmd/godoc: show comment before code block
The existing implementation shows a comment after its code block.
This causes confusion regarding how the comment relates to a code block.
Comments have been moved before their relative code blocks.

Fixes golang/go#16728

Change-Id: Ie07a6dd2f340a2555513662f263d26377060f93b
Reviewed-on: https://go-review.googlesource.com/33279
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-23 22:16:29 +00:00
Rebecca Stambler
e64f1a4c63 cmd/guru: add workaround to handle inconsistency between go/types and gc
Add identical workaround from gorename to guru. Only affects queries
that typecheck the code first.

Fixes golang/go#16530

Change-Id: I718cfceb8d26868eea9128c8873b164333c50f53
Reviewed-on: https://go-review.googlesource.com/33359
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-23 20:09:00 +00:00
Chris Stockton
4c6345e8dc imports: respect ignoredDirs for symlinks
Fixes golang/go#17916

Added tests.

Change-Id: Ie44e4bcbec267b6c16249336c5d48bae86acc2b5
Reviewed-on: https://go-review.googlesource.com/33246
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-23 02:24:47 +00:00
Chris Broadfoot
8b84dae173 godoc/dl: remove the tiny, unselectable SHA sums from Featured Downloads
The SHA sums are clearly visible (and copy-pastable) in the expanded section
immediately below it.

Fixes golang/go#16900.

Change-Id: If1805534b3893f6c38f4170c4b457ff0e935ce28
Reviewed-on: https://go-review.googlesource.com/33290
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-15 22:46:22 +00:00
Alan Donovan
5e2ae75eb7 go/ssa/interp: add syscall.Readlink intrinsic, needed by os package
Change-Id: Ie408fd5ffb2be2d60773eb3fda91912887df0a7e
Reviewed-on: https://go-review.googlesource.com/33147
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-11 21:41:07 +00:00
Alan Donovan
22ba3f367c go/gcimporter15: pretend blank fields have same owner
The export data formats (text and binary) emitted by gc in Go 1.7 did
not record the package that "owns" each blank field, even though blank
is an unexported identifier.  Before, gcimporter would assume the
package of the export data file owns blank fields within it, even
blank fields reexported from another package.  As a result, identical
types would become nonidentical during reexporting.

For bug compatibility with gc, gcimporter now treats blank fields as
if they all belong to the same dummy package, avoiding spurious "can't
assign A to B" errors in tools based on go/types.

Change-Id: I0dbf71491a0ec0f376e9dc8a91efe0376c855a28
Reviewed-on: https://go-review.googlesource.com/33146
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-11 21:27:08 +00:00
Robert Griesemer
a69656e0e2 go/gcimporter: update export data format version
We already are compatible with the latest format. Update version.

Tested against 1.6, 1.7, and tip.

Fixes golang/go#17734.

Change-Id: Ia167adf0ed1de371c348329513819fb9e8ca2628
Reviewed-on: https://go-review.googlesource.com/33113
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-11 18:00:05 +00:00
Robert Griesemer
c959b77b38 go/gcimporter15: update build tags and comments
We don't support Go1.5 anymore.

Tested with 1.6, 1.7, and tip.

For golang/go#17734.

Change-Id: I718c7996b99f9b98744346e119ee209b4709a070
Reviewed-on: https://go-review.googlesource.com/33111
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-11 17:55:17 +00:00
Alan Donovan
5061f921c7 go/gccgoexportdata: correctly handle archive files containing string tables
If the name of an archive member is longer than 16 bytes, an ELF archive
file contains a string table of file names under the name "//", and this
member has no mode.  Skip such members.

+ Test.

Change-Id: Ib10db1cc42816c9002433be6176240e490678560
Reviewed-on: https://go-review.googlesource.com/32973
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-09 21:28:38 +00:00
Josh Bleecher Snyder
44b4c5d044 cmd/toolstash: fix format string arguments
Found by vet.

Follow-up to comments on CL 32682.

Change-Id: I76391e02b9991bc480404f634ea809e75645e9dc
Reviewed-on: https://go-review.googlesource.com/32918
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-08 20:54:22 +00:00
Alan Donovan
7ce0cddaad go/ssa: synthesize Go 1.8-compatible test main package
...to match the new interface between "go test" and the standard testing
package.

Rather than generate SSA code directly, which was tricky and fragile, we
now generate source just as "go test" does, type-check it, and build an
SSA package from it.  crawshaw suggested I do this in the very first
version of testmain.go, but at the time I believed it to be infeasible.

The testMainStartBodyHook mechanism has gone away; installations that
needed it can now achieve the same results more easily by overriding the
templates.

Tested with Go 1.6, 1.7 and 1.8.

Fixes golang/go#17722

Change-Id: I3ffd25f01157f6fb7a39acd18af46f17e9c07b99
Reviewed-on: https://go-review.googlesource.com/32888
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-08 18:33:05 +00:00
Samuel Tan
09079c88dc go/gccgoexportdata: plumb additional arguments to gccgo compiler
Allow extra arguments to be passed to the specified gccgo compiler
when it is called in GccgoInstallation.InitFromDriver. This allows
the call to gccgo to be adjusted depending on the build environment.

For example, some build environments require the
'no-canonical-prefixes' option to prevent gccgo from resolving
symlinks when generating relative prefixes.

Change-Id: I0ecf338ee7a3780f1f65b30e214e69c1698041bb
Reviewed-on: https://go-review.googlesource.com/32874
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-07 23:39:01 +00:00
Robert Griesemer
46c63f3841 go/gcimporter15: revert user-visible changes related to aliases
Reason: Decision to back out current alias implementation.
For golang/go#16339 (comment).

Change-Id: Id2a394d78a8661c767bcc05370b81f79d9bfb714
Reviewed-on: https://go-review.googlesource.com/32756
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Manghane <cmang@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-11-05 01:00:22 +00:00
Alan Donovan
58ec10c513 go/ssa/interp: handle nil *hashmap cleanly
Change-Id: I2cb8eef79bc011b209b3df0b859bcddefd4c8337
Reviewed-on: https://go-review.googlesource.com/32818
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:49:12 +00:00
Alan Donovan
2e348630fd go/loader: fix fragile example test
Change-Id: Ib6313cdba54da8911b8a2ec9e1bc115c30ea6afe
Reviewed-on: https://go-review.googlesource.com/32817
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:44:43 +00:00
Alan Donovan
701d657347 tools: remove go1.8-tagged files
Change-Id: Ib52b85e1c981b6fca55c472120371a0cd37d2dc9
Reviewed-on: https://go-review.googlesource.com/32816
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:29:52 +00:00
Alan Donovan
be0bbf2399 refactor/...: remove go1.8-tagged files
Change-Id: I7df485b71ba87670d9e70e5b44e2110fd8f6a815
Reviewed-on: https://go-review.googlesource.com/32815
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:29:48 +00:00
Alan Donovan
fe1fa38300 go/ssa: remove go1.8 tagged files
Change-Id: Iac37a0dba27459f0484aa4e286c21bb618116619
Reviewed-on: https://go-review.googlesource.com/32836
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:18:10 +00:00
Alan Donovan
0e041570eb cmd/guru: revert support for Go 1.8 aliases
Change-Id: I8ba368d5036be47b6d64e3576f366eb0301d2d5b
Reviewed-on: https://go-review.googlesource.com/32831
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:18:07 +00:00
Alan Donovan
188d338f0b godoc: revert support for Go 1.8 aliases
Change-Id: Ibb3afede1121bd53567f3ff70b886b02dd81399f
Reviewed-on: https://go-review.googlesource.com/32832
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:17:32 +00:00