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

353 Commits

Author SHA1 Message Date
Cosmos Nicolaou
c5b4292eb3 cmd/godoc: add support for doc.Package.Notes
Add support for displaying the notes of the form 'MARKER(userid): comment' now collected by the go/doc package. Any two or more uppercase letters are recognised as a marker.

R=gri, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7334044
2013-02-14 20:35:08 -08:00
Russ Cox
8035cbd97c codereview: use hgapplydiff instead of hgpatch
Depends on https://golang.org/cl/7308067

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7312064
2013-02-07 23:15:08 -05:00
Russ Cox
e1448c07e1 codereview: show 'not lgtms' in hg p output (with lgtms)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7245043
2013-01-29 09:32:49 -08:00
Andrew Gerrand
2ee06a51be lib/godoc: link to Projects wiki page instead of dashboard
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7139057
2013-01-18 19:25:45 +11:00
Shenghou Ma
e470b3354c lib/godoc/example.html: htmlify the play code
Fixes #4539.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6942043
2012-12-13 19:08:51 +08:00
Russ Cox
c3d881b361 lib/codereview: suggest argument to hg mail / hg submit
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6924050
2012-12-11 13:36:55 -05:00
Russ Cox
dffdece819 godoc: move example list into index section
Putting it before the Index (where it is now) is wrong:
we don't even know what's in the package yet.

Fixes #4484.

R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/6868071
2012-12-10 20:20:00 -05:00
Brad Fitzpatrick
372cf8fe87 codereview: always use HTTPS
The new version of rietveld pushed 1.5 hours ago
requires HTTPS now, otherwise it issues a 301
to HTTPS which we barfed on.

R=golang-dev
CC=golang-dev
https://golang.org/cl/6782135
2012-11-29 11:19:55 -08:00
Shenghou Ma
792e664ee4 lib/godoc/codewalk.html: remove duplicate jquery inclusion
now we load jquery in its parent--godoc.html.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6814112
2012-11-18 02:28:54 +08:00
Shenghou Ma
bcdb7926dd codereview: protect against read-only upstream repository
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6742053
2012-10-20 17:23:48 +08:00
Uriel Mangado
df7b720708 codereview.py: Fix crash on auth error handling.
In recent Python versions .reason is a read-only property that simply gives you the msg value.

Fixes #4024

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6545052
2012-10-11 00:23:53 +08:00
Andrew Gerrand
8438641629 godoc: add dropdown playground to nav bar
R=gri, dsymonds, skybrian
CC=golang-dev
https://golang.org/cl/6631057
2012-10-10 11:17:47 +11:00
Andrew Gerrand
236e79cab3 godoc: fetch jQuery via https
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6614064
2012-10-08 10:40:56 +11:00
Shenghou Ma
eca37e1eed codereview: more mercurial interface fixes
Fixes #4131.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6614061
2012-10-08 04:19:36 +08:00
Shenghou Ma
593a628572 lib/godoc/godoc.html: try Google hosted jQuery first, fallback to locally hosted one
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6593078
2012-10-04 15:14:20 +08:00
Andrew Gerrand
3fd5e0be9d godoc: make examples editable and runnable in playground
R=dsymonds
CC=golang-dev
https://golang.org/cl/6523045
2012-10-04 16:53:05 +10:00
Andrew Gerrand
65dbe6786d godoc: add jQuery to Go repository, rewrite godocs.js to use jQuery
For golang.org I intend to rewrite the jquery link in godoc.html
to point to the Google-hosted jquery.js.

R=dsymonds, minux.ma
CC=golang-dev
https://golang.org/cl/6589071
2012-10-04 15:31:25 +10:00
Andrew Gerrand
e7f453148c godoc: show contents in correct order, expand sections on click
R=dsymonds
CC=gobot, golang-dev
https://golang.org/cl/6588079
2012-10-04 11:21:37 +10:00
Andrew Gerrand
516306f677 godoc: move Examples above Index and make them both collapsable
R=golang-dev, dsymonds, bradfitz, r
CC=golang-dev
https://golang.org/cl/6591066
2012-10-03 15:05:08 +10:00
Robert Hencke
10ea3254a8 codereview.py: suggest installing Mercurial from official website
Continuation of https://golang.org/cl/6499053/

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6584059
2012-10-03 06:58:24 +10:00
Shivakumar GN
b7331f9b3a codereview: use subprocess.call() instead of os.spawnvp() for portability
Fixes #4121.

R=golang-dev, minux.ma, dave, r
CC=golang-dev
https://golang.org/cl/6555049
2012-09-27 01:50:59 +08:00
Uriel Mangado
9b8c94a46f codereview.py: correct error handling without decorator
The decorator hides the number of function arguments from Mercurial,
so Mercurial cannot give proper error messages about commands
invoked with the wrong number of arguments.

Left a 'dummy' hgcommand decorator in place as a way to document
what functions are hg commands, and just in case we need some other
kind of hack in the future.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/6488059
2012-09-01 19:55:29 -04:00
Robert Griesemer
f597fa67c1 godoc: report error for directories with multiple packages
Fixes #3922.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/6453094
2012-08-09 16:10:46 -07:00
Robert Griesemer
3601f27708 godoc: make id attributes unique
Some browsers (e.g. IE9) ignore the case of 'id' attributes
which can lead to conflicts. Prefix non-generated 'id's with
"pkg-" to make them different from any generated attribute.

Also: Added missing entry for "Other packages" to top-level
index.

Fixes #3851.

R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/6449105
2012-08-07 17:45:58 -07:00
Dave Cheney
82cbcb0dd5 website: various html fixes
Fixes #3424.

R=fullung, adg
CC=golang-dev
https://golang.org/cl/6343088
2012-07-11 09:41:08 -07:00
Shenghou Ma
dbf6215dd6 codereview: support mercurial 2.2.1
We explicitly use plainformatter to avoid the
        user's debug setting changing our behavior.
        Fixes #3603.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6201069
2012-05-17 02:54:03 +08:00
Russ Cox
d2e70054c9 codereview: look for new release branches
R=adg
CC=golang-dev
https://golang.org/cl/6127048
2012-04-25 13:44:30 -07:00
Andrew Gerrand
f8dde60e2b doc: don't wrap package names in directory listing
Fixes #3522.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6063054
2012-04-20 10:04:13 -04:00
Anthony Martin
d3889ff322 codereview: restore help messages
Docstrings were not being set for the wrapper
functions returned by the hgcommand decorator.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6059043
2012-04-17 15:51:05 -07:00
Russ Cox
3b7feb7001 codereview: give advice on 'cannot create CL outside default branch'
Fixes #3430.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5981047
2012-04-02 12:55:23 -04:00
Robert Griesemer
5b5b42ea84 godoc: replace servePage's positional argument list
R=golang-dev, adg, bradfitz
CC=golang-dev
https://golang.org/cl/5869050
2012-03-30 10:42:56 -07:00
Andrew Gerrand
16fd9fd640 doc: link to Go Project Dashboard from package list
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5937048
2012-03-28 11:38:34 +11:00
Andrew Gerrand
c748689277 doc: update licensing text one more time
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5916046
2012-03-27 15:09:13 +11:00
Andrew Gerrand
308cc100e6 doc: update footer text
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5920043
2012-03-27 13:35:01 +11:00
Andrew Gerrand
d2991229bc doc: add Terms of Service
R=r
CC=golang-dev
https://golang.org/cl/5913044
2012-03-27 09:27:43 +11:00
Benny Siegert
f4ec146454 doc: Change id of footer
The heading "Copyright" uses id="copyright" as the anchor name.
However, there is also a <div id="copyright"> at the bottom.
Using the same ID value twice in the same file is illegal
(http://www.w3.org/TR/html401/struct/links.html#h-12.2.3).

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5909045
2012-03-26 09:12:15 -07:00
Andrew Gerrand
0b762d9523 godoc: make 'Overview' section collapsable
This makes packages with lengthly package comments easier to browse.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5901055
2012-03-26 14:10:27 +11:00
Robert Griesemer
cfd8b84f07 godoc: use shorter titles for tabs
In a browser with many open tabs, the tab titles become short
and uninformative because they all start with the same prefix
("Package ", "Directory ", etc.).

Permit use of shorter tab titles that start with the relevant
information first.

Fixes #3365.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5865056
2012-03-21 11:29:30 -07:00
Russ Cox
b4e0aeac32 lib/godoc: removing leading / from search links
srcLink includes the / now; adding another yields //,
which means something else entirely in URLs.

Fixes #3327.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5823060
2012-03-15 14:50:51 -04:00
Andrew Gerrand
9d08068d21 godoc: style example headings like links
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5819048
2012-03-15 08:09:54 +11:00
Andrew Gerrand
2b8bc93f32 godoc: use elastic layout for most pages
We use the absence of a Title to detect the front page.
I can't find other pages without titles, so this seems reasonable.

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5797076
2012-03-13 10:17:10 +11:00
Russ Cox
bd71072eee codereview: fix for Mercurial 2.1
Mercurial: the Python of version control systems.
Python: the Mercurial of programming languages.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5777066
2012-03-12 14:39:44 -04:00
Andrew Gerrand
4191ff2436 godoc: switch on +1 buttons
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5754048
2012-03-06 15:16:45 +11:00
Andrew Gerrand
f200b72a7c doc: add more gophers
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5753047
2012-03-06 12:50:52 +11:00
Ugorji Nwoke
0eb4df0bc8 cmd/godoc: remove extra / in paths
If I click on links which should send you to source code (e.g. type, function, etc),
the link is to //src/... (instead of /src/...).
This causes a DNS resolution failure on the browser.

Quick fix is to remove the leading / from package.html
(since godoc.go src links automatically add a leading / as necessary).

Fixes #3193.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5730059
2012-03-05 15:36:33 -05:00
Russ Cox
fae0d35043 godoc: support $GOPATH, simplify file system code
The motivation for this CL is to support $GOPATH well.
Since we already have a FileSystem interface, implement a
Plan 9-style name space.  Bind each of the $GOPATH src
directories onto the $GOROOT src/pkg directory: now
everything is laid out exactly like a normal $GOROOT and
needs very little special case code.

The filter files are no longer used (by us), so I think they
can just be deleted.  Similarly, the Mapping code and the
FileSystem interface were two different ways to accomplish
the same end, so delete the Mapping code.

Within the implementation, since FileSystem is defined to be
slash-separated, use package path consistently, leaving
path/filepath only for manipulating operating system paths.

I kept the -path flag, but I think it can be deleted too.

Fixes #2234.
Fixes #3046.

R=gri, r, r, rsc
CC=golang-dev
https://golang.org/cl/5711058
2012-03-05 10:02:46 -05:00
Andrew Gerrand
d1e726c583 doc: change menu, tweak front page
R=golang-dev, kyle, r
CC=golang-dev
https://golang.org/cl/5729052
2012-03-05 10:34:22 +11:00
Andrew Gerrand
4314087b62 godoc: hide "Subdirectories" subheading if it is the only section
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5731056
2012-03-04 09:57:09 +11:00
Andrew Gerrand
64bc38eb85 godoc: add Examples link to top-level index
R=golang-dev
CC=golang-dev
https://golang.org/cl/5702043
2012-02-28 16:05:12 +11:00
Robert Griesemer
ab169c6e3f godoc: don't show directories w/o packages in flat dir mode
The main change is simple: Both the Directory and DirEntry
struct have an extra field 'HasPkg' indicating whether the
directory contains any package files. The remaining changes
are more comments and adjustments to the template files.

Fixes #3121.

R=golang-dev, bradfitz, sameer
CC=golang-dev
https://golang.org/cl/5699072
2012-02-27 11:18:00 -08:00
Robert Griesemer
c1139549bc godoc: consistent placement of documentation sections
Fixes #1226.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5694052
2012-02-23 12:44:11 -08:00
Andrew Gerrand
89fd4dd766 godoc: support flat directory view again
R=bradfitz
CC=golang-dev
https://golang.org/cl/5690058
2012-02-22 09:25:56 +11:00
Shenghou Ma
d86213c371 codereview: add submit message support for newer clone URL and subrepos
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5689063
2012-02-21 16:10:48 -05:00
Scott Lawrence
05e80cffc3 godoc: fix tag mismatch validation errors
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5676099
2012-02-20 12:32:43 +11:00
Russ Cox
f7410873ba lib/time/zoneinfo: delete
Now in zoneinfo.zip.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5671098
2012-02-19 03:19:05 -05:00
Russ Cox
cb5e181fe7 time: switch to using (uncompressed) zoneinfo zip file
Removal of old zoneinfo files is a separate CL due to its size.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5676100
2012-02-19 03:16:20 -05:00
Russ Cox
9a59aec1a1 time: add zoneinfo files, mainly for non-Unix systems
Generated by lib/time/update.bash.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5676096
2012-02-18 20:36:51 -05:00
Russ Cox
228d941157 lib/time: add README, update.bash script
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5674104
2012-02-18 20:33:58 -05:00
Andrew Gerrand
7c9662f461 godoc: show example function doc comments in UI
R=gri
CC=golang-dev
https://golang.org/cl/5677061
2012-02-16 12:43:22 +11:00
Andrew Gerrand
f3c3130685 godoc: support for package examples, display example suffixes
Fixes #2896.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5677047
2012-02-16 09:44:01 +11:00
Brad Fitzpatrick
988968262d doc: fix links
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5671051
2012-02-15 00:59:01 -08:00
Gustavo Niemeyer
b4d32d832f lib/godoc: fix subdirectories html reference
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5677043
2012-02-14 22:18:29 -02:00
Andrew Gerrand
5ab935f68a godoc: list examples in index
Fixes #2897.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5658047
2012-02-14 14:52:00 +11:00
Andrew Gerrand
d84de09e1d godoc: new design
This is not the finished product,
but a good checkpoint from which to
proceed with further development.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5571061
2012-02-13 21:22:36 +11:00
Rob Pike
80e2472f87 godoc: static ids should be #lowercase
so they don't collide with names like #Index.
Fixes #2970.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5655066
2012-02-13 14:34:30 +11:00
Robert Griesemer
d5c89972d8 godoc: provide link to subdirectories, if any
R=rsc
CC=golang-dev
https://golang.org/cl/5626043
2012-02-03 10:17:37 -08:00
Russ Cox
870c9d1c09 codereview: allow spaces in y.tab.[ch]
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5620053
2012-02-03 10:54:05 -05:00
Brad Fitzpatrick
7dca24ee7e codereview: explain how to get hgpatch in error message
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5623045
2012-02-02 11:53:28 -08:00
Andrew Gerrand
e10150f96d codereview: don't check default paths when codereview disabled
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5622043
2012-02-02 14:25:13 -05:00
Russ Cox
deeb1b36dd codereview: ignore test files during 'hg gofmt'
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5581047
2012-01-30 13:41:29 -05:00
Russ Cox
fd693388e6 codereview: fix initialization check
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5596046
2012-01-29 14:04:24 -05:00
Russ Cox
ba31d662fe codereview: die if initialized twice
If this happens, something is misconfigured.
If we don't test for this explicitly, MatchAt ends
up calling itself recursively forever.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5576066
2012-01-29 12:33:13 -05:00
Russ Cox
71b1c6d3c9 godoc: move overview before API TOC
Compare:
http://swtch.com/junk/regexp0.html [old]
http://swtch.com/junk/regexp.html [new]

Especially for packages with large APIs, this makes the
overview more promiment, so that it can give the appropriate
context for reading the API list.  This should help significantly
in packages with large APIs, like net, so that the first thing users
see is not a jumble of functions but an introduction to the package.

R=adg, gri, r, kevlar, dsymonds, rogpeppe
CC=golang-dev
https://golang.org/cl/5573068
2012-01-26 13:02:03 -05:00
Robert Griesemer
d571c5ca78 go/doc: revert API change (per former discussion) and cleanup
Separating Method from Func made the code only more complicated
without adding much to the useability/readability of the API.
Reverted to where it was, but leaving the new method-specific
fields Orig and Level.

Former clients (godoc) of doc.Method only used the Func fields;
and because Func was embedded, no changes are needed with respect
to the removal of Method.

Changed type of Func.Recv from ast.Expr to string. This was a
long-standing TODO. Also implemented Func.Orig field (another TODO).

No further go/doc API changes are expected for Go 1.

R=rsc, r, r
CC=golang-dev
https://golang.org/cl/5577043
2012-01-25 16:48:06 -08:00
Russ Cox
ceb59b069e codereview: more fixes
Python and Mercurial are a matched pair.

R=adg
CC=golang-dev
https://golang.org/cl/5570065
2012-01-25 14:46:10 -05:00
Russ Cox
79d2c57043 codereview: support for subrepositories
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5564054
2012-01-25 14:32:10 -05:00
Robert Griesemer
d191ad11ae lib/godoc: use Type.Name directly
Also: remove an unused template variable declaration.

R=adg
CC=golang-dev
https://golang.org/cl/5572043
2012-01-23 16:08:05 -08:00
Andrew Gerrand
3358a5068a godoc: add anchors to cmd documentation headings
Also, disable server-side generation of TOC for commands as they would
only ever show Overview. The JS does a better job (for now).

Fixes #2732.

R=gri, dsymonds
CC=golang-dev
https://golang.org/cl/5558046
2012-01-19 18:59:06 +11:00
Andrew Gerrand
e547393fcc godoc: remove "need more packages?" link
Its need will be addressed in another way by the redesign.

Fixes #2719.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5536062
2012-01-19 15:00:27 +11:00
Robert Griesemer
45ca908f89 godoc: fix missing name change
Fixes godoc text mode (i.e., URL?m=text).

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5545043
2012-01-12 17:54:17 -08:00
Robert Griesemer
eac31c67a8 go/doc: streamlined go/doc API
- the main changes are removing the Doc suffix
  from the exported types, so instead of
  doc.TypeDoc one will have doc.Type, etc.

- All exported types now have a Name (or Names) field.
  For Values, the Names field lists all declared variables
  or constants.

- Methods have additional information about where they are
  coming from.

- There's a mode field instead of a bool to
  control the package's operation, which makes
  it easier to extend w/o API changes.

Except for the partially implemented new Method type,
this is based on existing code. A clean rewrite is in
progress based on this new API.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/5528060
2012-01-12 17:36:57 -08:00
Miki Tebeka
a3008e235e codereview: Initialize "found" in codereview.py.
Fixes #2569 (hg undo crashes when CL not found).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5489052
2011-12-16 10:39:20 -05:00
Yasuhiro Matsumoto
e62b40344d codereview: fix path slash issue.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5487057
2011-12-13 16:18:56 -05:00
Russ Cox
6bf84214c1 godoc: text wrapping
Example:

PACKAGE

package utf8
    import "unicode/utf8"

    Package utf8 implements functions and constants to support text
    encoded in UTF-8.  This package calls a Unicode character a rune for
    brevity.

CONSTANTS

const (
    RuneError = unicode.ReplacementChar // the "error" Rune or "replacement character".
    RuneSelf  = 0x80                    // characters below Runeself are represented as themselves in a single byte.
    UTFMax    = 4                       // maximum number of bytes of a UTF-8 encoded Unicode character.
)
    Numbers fundamental to the encoding.

FUNCTIONS

func DecodeLastRune(p []byte) (r rune, size int)
    DecodeLastRune unpacks the last UTF-8 encoding in p and returns the
    rune and its width in bytes.

func DecodeLastRuneInString(s string) (r rune, size int)
    DecodeLastRuneInString is like DecodeLastRune but its input is a
    string.

func DecodeRune(p []byte) (r rune, size int)
    DecodeRune unpacks the first UTF-8 encoding in p and returns the rune
    and its width in bytes.

func DecodeRuneInString(s string) (r rune, size int)
    DecodeRuneInString is like DecodeRune but its input is a string.

func EncodeRune(p []byte, r rune) int
    EncodeRune writes into p (which must be large enough) the UTF-8
    encoding of the rune.  It returns the number of bytes written.

func FullRune(p []byte) bool
    FullRune reports whether the bytes in p begin with a full UTF-8
    encoding of a rune.  An invalid encoding is considered a full Rune
    since it will convert as a width-1 error rune.

func FullRuneInString(s string) bool
    FullRuneInString is like FullRune but its input is a string.

func RuneCount(p []byte) int
    RuneCount returns the number of runes in p.  Erroneous and short
    encodings are treated as single runes of width 1 byte.

func RuneCountInString(s string) (n int)
    RuneCountInString is like RuneCount but its input is a string.

func RuneLen(r rune) int
    RuneLen returns the number of bytes required to encode the rune.

func RuneStart(b byte) bool
    RuneStart reports whether the byte could be the first byte of an
    encoded rune.  Second and subsequent bytes always have the top two
    bits set to 10.

func Valid(p []byte) bool
    Valid reports whether p consists entirely of valid UTF-8-encoded
    runes.

func ValidString(s string) bool
    ValidString reports whether s consists entirely of valid UTF-8-encoded
    runes.

TYPES

type String struct {
    // contains filtered or unexported fields
}
    String wraps a regular string with a small structure that provides
    more efficient indexing by code point index, as opposed to byte index.
    Scanning incrementally forwards or backwards is O(1) per index
    operation (although not as fast a range clause going forwards).
    Random access is O(N) in the length of the string, but the overhead is
    less than always scanning from the beginning.  If the string is ASCII,
    random access is O(1).  Unlike the built-in string type, String has
    internal mutable state and is not thread-safe.

func NewString(contents string) *String
    NewString returns a new UTF-8 string with the provided contents.

func (s *String) At(i int) rune
    At returns the rune with index i in the String.  The sequence of runes
    is the same as iterating over the contents with a "for range" clause.

func (s *String) Init(contents string) *String
    Init initializes an existing String to hold the provided contents.
    It returns a pointer to the initialized String.

func (s *String) IsASCII() bool
    IsASCII returns a boolean indicating whether the String contains only
    ASCII bytes.

func (s *String) RuneCount() int
    RuneCount returns the number of runes (Unicode code points) in the
    String.

func (s *String) Slice(i, j int) string
    Slice returns the string sliced at rune positions [i:j].

func (s *String) String() string
    String returns the contents of the String.  This method also means the
    String is directly printable by fmt.Print.

Fixes #2479.

R=golang-dev, dsymonds, mattn.jp, r, gri, r
CC=golang-dev
https://golang.org/cl/5472051
2011-12-13 13:33:40 -05:00
Christoph Hack
ecf4a9216e godoc: added an opensearch description document.
R=golang-dev, r, tux21b, rsc
CC=golang-dev
https://golang.org/cl/5479062
2011-12-12 18:01:06 -05:00
Olivier Duperray
e97a55810f godoc: <pre> must not occur inside <p>
Fixes #2532

R=golang-dev, dr.volker.dobler, rsc
CC=golang-dev
https://golang.org/cl/5450115
2011-12-07 15:00:38 -05:00
Volker Dobler
af84892643 godoc: Show type examples between variables and methods.
Fixes #2466.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5451094
2011-12-06 10:52:43 +11:00
Volker Dobler
1e5aecf6ce godoc: improved output of examples in html.
Fixes #2467.
Fixes #2464.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5447051
2011-12-02 09:52:31 +11:00
David Crawshaw
28cead8b6c codereview: gofmt check for non-src/ files
Gives other projects the benefit of the gofmt presubmit.
Results in minor changes in the doc/ directory:
        find doc -name \*.go -exec gofmt -d {} \;

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5158042
2011-11-18 12:42:30 -08:00
Russ Cox
cf5a1c0909 codereview: put message back in post-commit mails
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5417049
2011-11-18 14:30:06 -05:00
Russ Cox
ab957154b6 codereview: undo last night's rollback
Update version check from 1.4 to 1.9.  Suggest 2.0.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5413046
2011-11-18 12:58:44 -05:00
Andrew Gerrand
5ca38eda49 undo CL 5395044 / d88e746d3785
Breaks with hg 1.6.4. Roll back until it's fixed.

««« original CL description
codereview: cleanup + basic tests

R=adg, bradfitz
CC=golang-dev
https://golang.org/cl/5395044
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/5410047
2011-11-18 21:33:04 +11:00
Russ Cox
bbf952c3b4 codereview: cleanup + basic tests
R=adg, bradfitz
CC=golang-dev
https://golang.org/cl/5395044
2011-11-18 00:16:15 -05:00
Robert Griesemer
9859af879b godoc: provide mode for flat (non-indented) directory listings
This feature should make it easier to look at very large
directory trees.

- a new mode (URL: /pkg/?m=flat) shows directory listings w/o
  indentation and entries with full path (html and text mode)
- in text mode, hierarchical (non-flat) directory listings are
  now presented with indentation (/pkg/?m=text)
- in html mode, hierarchical (non-flat) directory listings are
  presented with slightly less indentation
- there is an internal hook for programmatic control of the
  display mode (for specialized versions of godoc).

R=bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5410043
2011-11-17 14:47:49 -08:00
Russ Cox
c0523e1db9 codereview: show LGTMs in hg p
Shows first line of any response that the codereview server
has identified as an LGTM.  Example output below.

5305046:
        big: update for fmt interface changes

        Nothing terribly interesting here.

        Reviewer: gri@golang.org
                gri: LGTM
        CC: golang-dev@googlegroups.com
        Files:
                src/pkg/big/int.go
                src/pkg/big/nat.go
                src/pkg/big/nat_test.go
                src/pkg/big/rat.go

5307044:
        exp/template/html: use rune

        Nothing terribly interesting here.

        Reviewer: mikesamuel@gmail.com, nigeltao@golang.org
                mikesamuel: I don't see a type def for rune.  Assuming that's a new intrinsic, LGTM.
        CC: golang-dev@googlegroups.com
        Files:
                src/pkg/exp/template/html/css.go
                src/pkg/exp/template/html/css_test.go
                src/pkg/exp/template/html/html.go
                src/pkg/exp/template/html/js.go

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5297045
2011-10-19 15:08:33 -04:00
Russ Cox
cb2f6cb05d godoc: generate package toc in template, not in JavaScript
1. Generate TOC for package pages using template,
instead of using JavaScript magic.  This makes the
pages generated by godoc -html easier to export
to other systems.

2. Make TOC one column.  It's hard to do two columns
portably without invoking JavaScript.

3. Since the TOC is only one column, show full type
signatures for functions and methods.  Many times
that's all you need to see anyway.

4. Name the section after the TOC "Overview".
Naming it something is important, to set it off
from the TOC and so that there's a quick link to
it in the TOC.

For now, some illustrative examples:

http://swtch.com:6060/pkg/io/
http://swtch.com:6060/pkg/strings/
http://swtch.com:6060/pkg/tabwriter/
http://swtch.com:6060/pkg/unicode/

Fixes #1982.

R=gri, bradfitz, r
CC=golang-dev
https://golang.org/cl/5303044
2011-10-18 16:23:35 -04:00
Andrew Gerrand
af1ae438b9 go/doc, godoc, gotest: support for reading example documentation
This CL introduces the go.Example type and go.Examples functions that
are used to represent and extract code samples from Go source.

They should be of the form:

// Output of this function.
func ExampleFoo() {
        fmt.Println("Output of this function.")
}

It also modifies godoc to read example code from _test.go files,
and include them in the HTML output with JavaScript-driven toggles.

It also implements testing of example functions with gotest.
The stdout/stderr is compared against the output comment on the
function.

This CL includes examples for the sort.Ints function and the
sort.SortInts type. After patching this CL in and re-building go/doc
and godoc, try
        godoc -http=localhost:6060
and visit http://localhost:6060/pkg/sort/

R=gri, r, rsc
CC=golang-dev
https://golang.org/cl/5137041
2011-10-06 11:56:17 -07:00
Russ Cox
351e1d5745 codereview: fix for Mercurial 1.9.2
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5127052
2011-10-05 12:08:41 -04:00
Yasuhiro Matsumoto
319dba4750 codereview: fix hg change in Windows console
lib/codereview: Unable to use vim for 'hg change' from windows console
reload(sys) break workaround for windows.
see:
http://mercurial.selenic.com/bts/issue2888
http://mercurial.selenic.com/bts/issue1452
Also does not work with backslash paths.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5150054
2011-10-05 12:07:13 -04:00
Russ Cox
1fa87ada55 codereview: extra repo sanity check
Also work around Mercurial issue 3023.

If anyone has local changes in their repo (due to
patch queues or whatever) stop them from leaking
into the main repository.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5144043
2011-09-26 18:32:16 -04:00