Gopher Robot submitted this change.
all: gofmt
go fmt the entire repo with Go 1.18 go fmt.
Change-Id: I9b9c77796d67dce6de9ceb154dd88058b9b8200f
Reviewed-on: https://go-review.googlesource.com/c/build/+/399039
Trust: Michael Pratt <mpr...@google.com>
Run-TryBot: Michael Pratt <mpr...@google.com>
Auto-Submit: Michael Pratt <mpr...@google.com>
Reviewed-by: Dmitri Shuralyov <dmit...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
---
M influx/main.go
M livelog/livelog.go
M perfdata/app/upload.go
M perfdata/appengine/app.go
M perfdata/client.go
M perfdata/client_test.go
M perfdata/db/db.go
M perfdata/db/db_test.go
M perfdata/fs/local/local.go
M vcs-test/vcweb/auth.go
M vcs-test/vcweb/bzr.go
M vcs-test/vcweb/fossil.go
M vcs-test/vcweb/git.go
M vcs-test/vcweb/hg.go
M vcs-test/vcweb/insecure.go
M vcs-test/vcweb/load.go
M vcs-test/vcweb/svn.go
M vcs-test/vcweb/tls.go
18 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/influx/main.go b/influx/main.go
index bf6f598..5e8952c 100644
--- a/influx/main.go
+++ b/influx/main.go
@@ -23,17 +23,17 @@
"os/exec"
"time"
- "github.com/influxdata/influxdb-client-go/v2"
- "github.com/influxdata/influxdb-client-go/v2/domain"
"cloud.google.com/go/compute/metadata"
secretmanager "cloud.google.com/go/secretmanager/apiv1"
- secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
+ "github.com/influxdata/influxdb-client-go/v2"
+ "github.com/influxdata/influxdb-client-go/v2/domain"
"golang.org/x/build/internal/https"
+ secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
)
const (
influxListen = "localhost:8086"
- influxURL = "http://"+influxListen
+ influxURL = "http://" + influxListen
)
func main() {
diff --git a/livelog/livelog.go b/livelog/livelog.go
index 0f954af..1d5a8ce 100644
--- a/livelog/livelog.go
+++ b/livelog/livelog.go
@@ -36,7 +36,7 @@
type Buffer struct {
mu sync.Mutex // Guards the fields below.
wake *sync.Cond // Created on demand by reader.
- buf []byte // Length is in the range [0, MaxBufferSize].
+ buf []byte // Length is in the range [0, MaxBufferSize].
eof bool
lastID int
}
diff --git a/perfdata/app/upload.go b/perfdata/app/upload.go
index cc00f70..2299121 100644
--- a/perfdata/app/upload.go
+++ b/perfdata/app/upload.go
@@ -17,9 +17,9 @@
"strings"
"time"
+ "golang.org/x/build/perfdata/db"
"golang.org/x/net/context"
"golang.org/x/perf/storage/benchfmt"
- "golang.org/x/build/perfdata/db"
)
// upload is the handler for the /upload endpoint. It serves a form on
diff --git a/perfdata/appengine/app.go b/perfdata/appengine/app.go
index b8a638f..14a0bfb 100644
--- a/perfdata/appengine/app.go
+++ b/perfdata/appengine/app.go
@@ -15,10 +15,10 @@
"time"
_ "github.com/go-sql-driver/mysql"
- "golang.org/x/net/context"
"golang.org/x/build/perfdata/app"
"golang.org/x/build/perfdata/db"
"golang.org/x/build/perfdata/fs/gcs"
+ "golang.org/x/net/context"
oauth2 "google.golang.org/api/oauth2/v2"
"google.golang.org/appengine"
aelog "google.golang.org/appengine/log"
diff --git a/perfdata/client.go b/perfdata/client.go
index 2e0d24a..c609e7f 100644
--- a/perfdata/client.go
+++ b/perfdata/client.go
@@ -14,9 +14,9 @@
"net/http"
"net/url"
- "golang.org/x/perf/storage/benchfmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
+ "golang.org/x/perf/storage/benchfmt"
)
// A Client issues queries to a performance data storage server.
diff --git a/perfdata/client_test.go b/perfdata/client_test.go
index 3de82dd..6256d65 100644
--- a/perfdata/client_test.go
+++ b/perfdata/client_test.go
@@ -14,9 +14,9 @@
"reflect"
"testing"
- "golang.org/x/perf/storage/benchfmt"
- "golang.org/x/net/context"
"golang.org/x/build/internal/diff"
+ "golang.org/x/net/context"
+ "golang.org/x/perf/storage/benchfmt"
)
func TestQueryError(t *testing.T) {
diff --git a/perfdata/db/db.go b/perfdata/db/db.go
index 4bd1c94..499ef7c 100644
--- a/perfdata/db/db.go
+++ b/perfdata/db/db.go
@@ -18,10 +18,10 @@
"text/template"
"time"
- "golang.org/x/net/context"
"golang.org/x/build/perfdata"
- "golang.org/x/perf/storage/benchfmt"
"golang.org/x/build/perfdata/query"
+ "golang.org/x/net/context"
+ "golang.org/x/perf/storage/benchfmt"
)
// TODO(quentin): Add Context to every function when App Engine supports Go >=1.8.
diff --git a/perfdata/db/db_test.go b/perfdata/db/db_test.go
index 36e9e5a..c277e64 100644
--- a/perfdata/db/db_test.go
+++ b/perfdata/db/db_test.go
@@ -17,11 +17,11 @@
"testing"
"time"
- "golang.org/x/net/context"
"golang.org/x/build/internal/diff"
- "golang.org/x/perf/storage/benchfmt"
. "golang.org/x/build/perfdata/db"
"golang.org/x/build/perfdata/db/dbtest"
+ "golang.org/x/net/context"
+ "golang.org/x/perf/storage/benchfmt"
)
// Most of the db package is tested via the end-to-end-tests in perf/storage/app.
diff --git a/perfdata/fs/local/local.go b/perfdata/fs/local/local.go
index a165ece..b2790a6 100644
--- a/perfdata/fs/local/local.go
+++ b/perfdata/fs/local/local.go
@@ -11,8 +11,8 @@
"os"
"path/filepath"
- "golang.org/x/net/context"
"golang.org/x/build/perfdata/fs"
+ "golang.org/x/net/context"
)
// impl is an fs.FS backed by local disk.
diff --git a/vcs-test/vcweb/auth.go b/vcs-test/vcweb/auth.go
index 09e3237..1f3fe69 100644
--- a/vcs-test/vcweb/auth.go
+++ b/vcs-test/vcweb/auth.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/vcs-test/vcweb/bzr.go b/vcs-test/vcweb/bzr.go
index 468d6d7..d6cdf4f 100644
--- a/vcs-test/vcweb/bzr.go
+++ b/vcs-test/vcweb/bzr.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/vcs-test/vcweb/fossil.go b/vcs-test/vcweb/fossil.go
index 2640137..5fcbdcf 100644
--- a/vcs-test/vcweb/fossil.go
+++ b/vcs-test/vcweb/fossil.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/vcs-test/vcweb/git.go b/vcs-test/vcweb/git.go
index 5396fad..7fde62c 100644
--- a/vcs-test/vcweb/git.go
+++ b/vcs-test/vcweb/git.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/vcs-test/vcweb/hg.go b/vcs-test/vcweb/hg.go
index 18cc1e8..0400732 100644
--- a/vcs-test/vcweb/hg.go
+++ b/vcs-test/vcweb/hg.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/vcs-test/vcweb/insecure.go b/vcs-test/vcweb/insecure.go
index eb74348..937a12f 100644
--- a/vcs-test/vcweb/insecure.go
+++ b/vcs-test/vcweb/insecure.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/vcs-test/vcweb/load.go b/vcs-test/vcweb/load.go
index f4b3d7f..5d7c686 100644
--- a/vcs-test/vcweb/load.go
+++ b/vcs-test/vcweb/load.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/vcs-test/vcweb/svn.go b/vcs-test/vcweb/svn.go
index 7e98179..1e95621 100644
--- a/vcs-test/vcweb/svn.go
+++ b/vcs-test/vcweb/svn.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/vcs-test/vcweb/tls.go b/vcs-test/vcweb/tls.go
index b22ffb6..0e934d7 100644
--- a/vcs-test/vcweb/tls.go
+++ b/vcs-test/vcweb/tls.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
To view, visit change 399039. To unsubscribe, or for help writing mail filters, visit settings.
Russ Cox submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: I3573e720b522fe41f726d2fb4e3b988ee883872d
Reviewed-on: https://go-review.googlesource.com/c/website/+/399608
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M cmd/screentest/main.go
M cmd/versionprune/doc.go
M internal/backport/fmtsort/sort.go
M internal/backport/html/template/context.go
M internal/backport/html/template/doc.go
M internal/backport/html/template/error.go
M internal/backport/html/template/escape.go
M internal/backport/html/template/html.go
M internal/backport/html/template/template.go
M internal/backport/html/template/url.go
M internal/backport/text/template/funcs.go
M internal/backport/text/template/helper.go
M internal/backport/text/template/option.go
M internal/backport/text/template/parse/parse.go
M internal/dl/dl.go
M internal/dl/server.go
M internal/history/history.go
M internal/screentest/screentest.go
M internal/short/short.go
M internal/tmplfunc/tmpl.go
M internal/web/site.go
M internal/webtest/webtest.go
22 files changed, 246 insertions(+), 186 deletions(-)
diff --git a/cmd/screentest/main.go b/cmd/screentest/main.go
index a2a2129..da831db 100644
--- a/cmd/screentest/main.go
+++ b/cmd/screentest/main.go
@@ -4,17 +4,19 @@
/*
Command screentest runs the screentest check for a set of scripts.
- Usage: screentest [flags] [glob]
+
+ Usage: screentest [flags] [glob]
The flags are:
- -u
- update cached screenshots
- -v
- variables provided to script templates as comma separated KEY:VALUE pairs
- -c
- number of testcases to run concurrently
- -d
- chrome debugger url
+
+ -u
+ update cached screenshots
+ -v
+ variables provided to script templates as comma separated KEY:VALUE pairs
+ -c
+ number of testcases to run concurrently
+ -d
+ chrome debugger url
*/
package main
diff --git a/cmd/versionprune/doc.go b/cmd/versionprune/doc.go
index 51ac8aa..6c2a004 100644
--- a/cmd/versionprune/doc.go
+++ b/cmd/versionprune/doc.go
@@ -41,6 +41,5 @@
]
deleting go-discovery/go-dev/20191030t225128
...
-
*/
package main
diff --git a/internal/backport/fmtsort/sort.go b/internal/backport/fmtsort/sort.go
index 7127ba6..e0585dc 100644
--- a/internal/backport/fmtsort/sort.go
+++ b/internal/backport/fmtsort/sort.go
@@ -36,19 +36,18 @@
//
// The ordering rules are more general than with Go's < operator:
//
-// - when applicable, nil compares low
-// - ints, floats, and strings order by <
-// - NaN compares less than non-NaN floats
-// - bool compares false before true
-// - complex compares real, then imag
-// - pointers compare by machine address
-// - channel values compare by machine address
-// - structs compare each field in turn
-// - arrays compare each element in turn.
-// Otherwise identical arrays compare by length.
-// - interface values compare first by reflect.Type describing the concrete type
-// and then by concrete value as described in the previous rules.
-//
+// - when applicable, nil compares low
+// - ints, floats, and strings order by <
+// - NaN compares less than non-NaN floats
+// - bool compares false before true
+// - complex compares real, then imag
+// - pointers compare by machine address
+// - channel values compare by machine address
+// - structs compare each field in turn
+// - arrays compare each element in turn.
+// Otherwise identical arrays compare by length.
+// - interface values compare first by reflect.Type describing the concrete type
+// and then by concrete value as described in the previous rules.
func Sort(mapValue reflect.Value) *SortedMap {
if mapValue.Type().Kind() != reflect.Map {
return nil
diff --git a/internal/backport/html/template/context.go b/internal/backport/html/template/context.go
index 1aacec4..ce21e95 100644
--- a/internal/backport/html/template/context.go
+++ b/internal/backport/html/template/context.go
@@ -80,7 +80,9 @@
// HTML5 parsing algorithm because a single token production in the HTML
// grammar may contain embedded actions in a template. For instance, the quoted
// HTML attribute produced by
-// <div title="Hello {{.World}}">
+//
+// <div title="Hello {{.World}}">
+//
// is a single token in HTML's grammar but in a template spans several nodes.
type state uint8
diff --git a/internal/backport/html/template/doc.go b/internal/backport/html/template/doc.go
index ed2a7e2..cb5bcbe 100644
--- a/internal/backport/html/template/doc.go
+++ b/internal/backport/html/template/doc.go
@@ -12,14 +12,14 @@
For information about how to program the templates themselves, see the
documentation for text/template.
-Introduction
+# Introduction
This package wraps package text/template so you can share its template API
to parse and execute HTML templates safely.
- tmpl, err := template.New("name").Parse(...)
- // Error checking elided
- err = tmpl.Execute(out, data)
+ tmpl, err := template.New("name").Parse(...)
+ // Error checking elided
+ err = tmpl.Execute(out, data)
If successful, tmpl will now be injection-safe. Otherwise, err is an error
defined in the docs for ErrorCode.
@@ -34,38 +34,37 @@
Example
- import "golang.org/x/website/internal/backport/text/template"
- ...
- t, err := template.New("foo").Parse(`{{define "T"}}Hello, {{.}}!{{end}}`)
- err = t.ExecuteTemplate(out, "T", "<script>alert('you have been pwned')</script>")
+ import "golang.org/x/website/internal/backport/text/template"
+ ...
+ t, err := template.New("foo").Parse(`{{define "T"}}Hello, {{.}}!{{end}}`)
+ err = t.ExecuteTemplate(out, "T", "<script>alert('you have been pwned')</script>")
produces
- Hello, <script>alert('you have been pwned')</script>!
+ Hello, <script>alert('you have been pwned')</script>!
but the contextual autoescaping in html/template
- import "html/template"
- ...
- t, err := template.New("foo").Parse(`{{define "T"}}Hello, {{.}}!{{end}}`)
- err = t.ExecuteTemplate(out, "T", "<script>alert('you have been pwned')</script>")
+ import "html/template"
+ ...
+ t, err := template.New("foo").Parse(`{{define "T"}}Hello, {{.}}!{{end}}`)
+ err = t.ExecuteTemplate(out, "T", "<script>alert('you have been pwned')</script>")
produces safe, escaped HTML output
- Hello, <script>alert('you have been pwned')</script>!
+ Hello, <script>alert('you have been pwned')</script>!
-
-Contexts
+# Contexts
This package understands HTML, CSS, JavaScript, and URIs. It adds sanitizing
functions to each simple action pipeline, so given the excerpt
- <a href="/search?q={{.}}">{{.}}</a>
+ <a href="/search?q={{.}}">{{.}}</a>
At parse time each {{.}} is overwritten to add escaping functions as necessary.
In this case it becomes
- <a href="/search?q={{. | urlescaper | attrescaper}}">{{. | htmlescaper}}</a>
+ <a href="/search?q={{. | urlescaper | attrescaper}}">{{. | htmlescaper}}</a>
where urlescaper, attrescaper, and htmlescaper are aliases for internal escaping
functions.
@@ -73,117 +72,113 @@
For these internal escaping functions, if an action pipeline evaluates to
a nil interface value, it is treated as though it were an empty string.
-Namespaced and data- attributes
+# Namespaced and data- attributes
Attributes with a namespace are treated as if they had no namespace.
Given the excerpt
- <a my:href="{{.}}"></a>
+ <a my:href="{{.}}"></a>
At parse time the attribute will be treated as if it were just "href".
So at parse time the template becomes:
- <a my:href="{{. | urlescaper | attrescaper}}"></a>
+ <a my:href="{{. | urlescaper | attrescaper}}"></a>
Similarly to attributes with namespaces, attributes with a "data-" prefix are
treated as if they had no "data-" prefix. So given
- <a data-href="{{.}}"></a>
+ <a data-href="{{.}}"></a>
At parse time this becomes
- <a data-href="{{. | urlescaper | attrescaper}}"></a>
+ <a data-href="{{. | urlescaper | attrescaper}}"></a>
If an attribute has both a namespace and a "data-" prefix, only the namespace
will be removed when determining the context. For example
- <a my:data-href="{{.}}"></a>
+ <a my:data-href="{{.}}"></a>
This is handled as if "my:data-href" was just "data-href" and not "href" as
it would be if the "data-" prefix were to be ignored too. Thus at parse
time this becomes just
- <a my:data-href="{{. | attrescaper}}"></a>
+ <a my:data-href="{{. | attrescaper}}"></a>
As a special case, attributes with the namespace "xmlns" are always treated
as containing URLs. Given the excerpts
- <a xmlns:title="{{.}}"></a>
- <a xmlns:href="{{.}}"></a>
- <a xmlns:onclick="{{.}}"></a>
+ <a xmlns:title="{{.}}"></a>
+ <a xmlns:href="{{.}}"></a>
+ <a xmlns:onclick="{{.}}"></a>
At parse time they become:
- <a xmlns:title="{{. | urlescaper | attrescaper}}"></a>
- <a xmlns:href="{{. | urlescaper | attrescaper}}"></a>
- <a xmlns:onclick="{{. | urlescaper | attrescaper}}"></a>
+ <a xmlns:title="{{. | urlescaper | attrescaper}}"></a>
+ <a xmlns:href="{{. | urlescaper | attrescaper}}"></a>
+ <a xmlns:onclick="{{. | urlescaper | attrescaper}}"></a>
-Errors
+# Errors
See the documentation of ErrorCode for details.
-
-A fuller picture
+# A fuller picture
The rest of this package comment may be skipped on first reading; it includes
details necessary to understand escaping contexts and error messages. Most users
will not need to understand these details.
-
-Contexts
+# Contexts
Assuming {{.}} is `O'Reilly: How are <i>you</i>?`, the table below shows
how {{.}} appears when used in the context to the left.
- Context {{.}} After
- {{.}} O'Reilly: How are <i>you</i>?
- <a title='{{.}}'> O'Reilly: How are you?
- <a href="/{{.}}"> O'Reilly: How are %3ci%3eyou%3c/i%3e?
- <a href="?q={{.}}"> O'Reilly%3a%20How%20are%3ci%3e...%3f
- <a onx='f("{{.}}")'> O\x27Reilly: How are \x3ci\x3eyou...?
- <a onx='f({{.}})'> "O\x27Reilly: How are \x3ci\x3eyou...?"
- <a onx='pattern = /{{.}}/;'> O\x27Reilly: How are \x3ci\x3eyou...\x3f
+ Context {{.}} After
+ {{.}} O'Reilly: How are <i>you</i>?
+ <a title='{{.}}'> O'Reilly: How are you?
+ <a href="/{{.}}"> O'Reilly: How are %3ci%3eyou%3c/i%3e?
+ <a href="?q={{.}}"> O'Reilly%3a%20How%20are%3ci%3e...%3f
+ <a onx='f("{{.}}")'> O\x27Reilly: How are \x3ci\x3eyou...?
+ <a onx='f({{.}})'> "O\x27Reilly: How are \x3ci\x3eyou...?"
+ <a onx='pattern = /{{.}}/;'> O\x27Reilly: How are \x3ci\x3eyou...\x3f
If used in an unsafe context, then the value might be filtered out:
- Context {{.}} After
- <a href="{{.}}"> #ZgotmplZ
+ Context {{.}} After
+ <a href="{{.}}"> #ZgotmplZ
since "O'Reilly:" is not an allowed protocol like "http:".
-
If {{.}} is the innocuous word, `left`, then it can appear more widely,
- Context {{.}} After
- {{.}} left
- <a title='{{.}}'> left
- <a href='{{.}}'> left
- <a href='/{{.}}'> left
- <a href='?dir={{.}}'> left
- <a style="border-{{.}}: 4px"> left
- <a style="align: {{.}}"> left
- <a style="background: '{{.}}'> left
- <a style="background: url('{{.}}')> left
- <style>p.{{.}} {color:red}</style> left
+ Context {{.}} After
+ {{.}} left
+ <a title='{{.}}'> left
+ <a href='{{.}}'> left
+ <a href='/{{.}}'> left
+ <a href='?dir={{.}}'> left
+ <a style="border-{{.}}: 4px"> left
+ <a style="align: {{.}}"> left
+ <a style="background: '{{.}}'> left
+ <a style="background: url('{{.}}')> left
+ <style>p.{{.}} {color:red}</style> left
Non-string values can be used in JavaScript contexts.
If {{.}} is
- struct{A,B string}{ "foo", "bar" }
+ struct{A,B string}{ "foo", "bar" }
in the escaped template
- <script>var pair = {{.}};</script>
+ <script>var pair = {{.}};</script>
then the template output is
- <script>var pair = {"A": "foo", "B": "bar"};</script>
+ <script>var pair = {"A": "foo", "B": "bar"};</script>
See package json to understand how non-string content is marshaled for
embedding in JavaScript contexts.
-
-Typed Strings
+# Typed Strings
By default, this package assumes that all pipelines produce a plain text string.
It adds escaping pipeline stages necessary to correctly and safely embed that
@@ -197,24 +192,23 @@
The template
- Hello, {{.}}!
+ Hello, {{.}}!
can be invoked with
- tmpl.Execute(out, template.HTML(`<b>World</b>`))
+ tmpl.Execute(out, template.HTML(`<b>World</b>`))
to produce
- Hello, <b>World</b>!
+ Hello, <b>World</b>!
instead of the
- Hello, <b>World<b>!
+ Hello, <b>World<b>!
that would have been produced if {{.}} was a regular string.
-
-Security Model
+# Security Model
https://rawgit.com/mikesamuel/sanitized-jquery-templates/trunk/safetemplate.html#problem_definition defines "safe" as used by this package.
diff --git a/internal/backport/html/template/error.go b/internal/backport/html/template/error.go
index 0eae11f..69b0756 100644
--- a/internal/backport/html/template/error.go
+++ b/internal/backport/html/template/error.go
@@ -33,14 +33,17 @@
//
// Output: "ZgotmplZ"
// Example:
-// <img src="{{.X}}">
-// where {{.X}} evaluates to `javascript:...`
+//
+// <img src="{{.X}}">
+// where {{.X}} evaluates to `javascript:...`
+//
// Discussion:
-// "ZgotmplZ" is a special value that indicates that unsafe content reached a
-// CSS or URL context at runtime. The output of the example will be
-// <img src="#ZgotmplZ">
-// If the data comes from a trusted source, use content types to exempt it
-// from filtering: URL(`javascript:...`).
+//
+// "ZgotmplZ" is a special value that indicates that unsafe content reached a
+// CSS or URL context at runtime. The output of the example will be
+// <img src="#ZgotmplZ">
+// If the data comes from a trusted source, use content types to exempt it
+// from filtering: URL(`javascript:...`).
const (
// OK indicates the lack of an error.
OK ErrorCode = iota
diff --git a/internal/backport/html/template/escape.go b/internal/backport/html/template/escape.go
index dfdfea5..e7f3122 100644
--- a/internal/backport/html/template/escape.go
+++ b/internal/backport/html/template/escape.go
@@ -412,13 +412,19 @@
// nudge returns the context that would result from following empty string
// transitions from the input context.
// For example, parsing:
-// `<a href=`
+//
+// `<a href=`
+//
// will end in context{stateBeforeValue, attrURL}, but parsing one extra rune:
-// `<a href=x`
+//
+// `<a href=x`
+//
// will end in context{stateURL, delimSpaceOrTagEnd, ...}.
// There are two transitions that happen when the 'x' is seen:
// (1) Transition from a before-value state to a start-of-value state without
-// consuming any character.
+//
+// consuming any character.
+//
// (2) Consume 'x' and transition past the first value character.
// In this case, nudging produces the context after (1) happens.
func nudge(c context) context {
diff --git a/internal/backport/html/template/html.go b/internal/backport/html/template/html.go
index 356b829..46e9b44 100644
--- a/internal/backport/html/template/html.go
+++ b/internal/backport/html/template/html.go
@@ -84,10 +84,12 @@
// <script>(function () {
// var a = [], d = document.getElementById("d"), i, c, s;
// for (i = 0; i < 0x10000; ++i) {
-// c = String.fromCharCode(i);
-// d.innerHTML = "<span title=" + c + "lt" + c + "></span>"
-// s = d.getElementsByTagName("SPAN")[0];
-// if (!s || s.title !== c + "lt" + c) { a.push(i.toString(16)); }
+//
+// c = String.fromCharCode(i);
+// d.innerHTML = "<span title=" + c + "lt" + c + "></span>"
+// s = d.getElementsByTagName("SPAN")[0];
+// if (!s || s.title !== c + "lt" + c) { a.push(i.toString(16)); }
+//
// }
// document.write(a.join(", "));
// })()</script>
diff --git a/internal/backport/html/template/template.go b/internal/backport/html/template/template.go
index ca77b72..6cc709e 100644
--- a/internal/backport/html/template/template.go
+++ b/internal/backport/html/template/template.go
@@ -65,6 +65,7 @@
//
// missingkey: Control the behavior during execution if a map is
// indexed with a key that is not present in the map.
+//
// "missingkey=default" or "missingkey=invalid"
// The default behavior: Do nothing and continue execution.
// If printed, the result of the index operation is the string
@@ -73,7 +74,6 @@
// The operation returns the zero value for the map type's element.
// "missingkey=error"
// Execution stops immediately with an error.
-//
func (t *Template) Option(opt ...string) *Template {
t.text.Option(opt...)
return t
@@ -369,6 +369,7 @@
// Must is a helper that wraps a call to a function returning (*Template, error)
// and panics if the error is non-nil. It is intended for use in variable initializations
// such as
+//
// var t = template.Must(template.New("name").Parse("html"))
func Must(t *Template, err error) *Template {
if err != nil {
diff --git a/internal/backport/html/template/url.go b/internal/backport/html/template/url.go
index 6f8185a..a0c0012 100644
--- a/internal/backport/html/template/url.go
+++ b/internal/backport/html/template/url.go
@@ -19,15 +19,15 @@
//
// This filter conservatively assumes that all schemes other than the following
// are unsafe:
-// * http: Navigates to a new website, and may open a new window or tab.
-// These side effects can be reversed by navigating back to the
-// previous website, or closing the window or tab. No irreversible
-// changes will take place without further user interaction with
-// the new website.
-// * https: Same as http.
-// * mailto: Opens an email program and starts a new draft. This side effect
-// is not irreversible until the user explicitly clicks send; it
-// can be undone by closing the email program.
+// - http: Navigates to a new website, and may open a new window or tab.
+// These side effects can be reversed by navigating back to the
+// previous website, or closing the window or tab. No irreversible
+// changes will take place without further user interaction with
+// the new website.
+// - https: Same as http.
+// - mailto: Opens an email program and starts a new draft. This side effect
+// is not irreversible until the user explicitly clicks send; it
+// can be undone by closing the email program.
//
// To allow URLs containing other schemes to bypass this filter, developers must
// explicitly indicate that such a URL is expected and safe by encapsulating it
diff --git a/internal/backport/text/template/funcs.go b/internal/backport/text/template/funcs.go
index 11e2e90..23425b4 100644
--- a/internal/backport/text/template/funcs.go
+++ b/internal/backport/text/template/funcs.go
@@ -729,7 +729,9 @@
}
// evalArgs formats the list of arguments into a string. It is therefore equivalent to
+//
// fmt.Sprint(args...)
+//
// except that each argument is indirected (if a pointer), as required,
// using the same rules as the default string evaluation during template
// execution.
diff --git a/internal/backport/text/template/helper.go b/internal/backport/text/template/helper.go
index 8269fa2..481527a 100644
--- a/internal/backport/text/template/helper.go
+++ b/internal/backport/text/template/helper.go
@@ -19,6 +19,7 @@
// Must is a helper that wraps a call to a function returning (*Template, error)
// and panics if the error is non-nil. It is intended for use in variable
// initializations such as
+//
// var t = template.Must(template.New("name").Parse("text"))
func Must(t *Template, err error) *Template {
if err != nil {
diff --git a/internal/backport/text/template/option.go b/internal/backport/text/template/option.go
index addce2d..f2c6681 100644
--- a/internal/backport/text/template/option.go
+++ b/internal/backport/text/template/option.go
@@ -30,6 +30,7 @@
//
// missingkey: Control the behavior during execution if a map is
// indexed with a key that is not present in the map.
+//
// "missingkey=default" or "missingkey=invalid"
// The default behavior: Do nothing and continue execution.
// If printed, the result of the index operation is the string
@@ -38,7 +39,6 @@
// The operation returns the zero value for the map type's element.
// "missingkey=error"
// Execution stops immediately with an error.
-//
func (t *Template) Option(opt ...string) *Template {
t.init()
for _, s := range opt {
diff --git a/internal/backport/text/template/parse/parse.go b/internal/backport/text/template/parse/parse.go
index d92bed5..efae999 100644
--- a/internal/backport/text/template/parse/parse.go
+++ b/internal/backport/text/template/parse/parse.go
@@ -342,7 +342,9 @@
}
// itemList:
+//
// textOrAction*
+//
// Terminates at {{end}} or {{else}}, returned separately.
func (t *Tree) itemList() (list *ListNode, next Node) {
list = t.newList(t.peekNonSpace().pos)
@@ -359,6 +361,7 @@
}
// textOrAction:
+//
// text | comment | action
func (t *Tree) textOrAction() Node {
switch token := t.nextNonSpace(); token.typ {
@@ -381,8 +384,10 @@
}
// Action:
+//
// control
// command ("|" command)*
+//
// Left delim is past. Now get actions.
// First word could be a keyword such as range.
func (t *Tree) action() (n Node) {
@@ -413,7 +418,9 @@
}
// Break:
+//
// {{break}}
+//
// Break keyword is past.
func (t *Tree) breakControl(pos Pos, line int) Node {
if token := t.next(); token.typ != itemRightDelim {
@@ -426,7 +433,9 @@
}
// Continue:
+//
// {{continue}}
+//
// Continue keyword is past.
func (t *Tree) continueControl(pos Pos, line int) Node {
if token := t.next(); token.typ != itemRightDelim {
@@ -439,6 +448,7 @@
}
// Pipeline:
+//
// declarations? command ('|' command)*
func (t *Tree) pipeline(context string, end itemType) (pipe *PipeNode) {
token := t.peekNonSpace()
@@ -550,16 +560,20 @@
}
// If:
+//
// {{if pipeline}} itemList {{end}}
// {{if pipeline}} itemList {{else}} itemList {{end}}
+//
// If keyword is past.
func (t *Tree) ifControl() Node {
return t.newIf(t.parseControl(true, "if"))
}
// Range:
+//
// {{range pipeline}} itemList {{end}}
// {{range pipeline}} itemList {{else}} itemList {{end}}
+//
// Range keyword is past.
func (t *Tree) rangeControl() Node {
r := t.newRange(t.parseControl(false, "range"))
@@ -567,22 +581,28 @@
}
// With:
+//
// {{with pipeline}} itemList {{end}}
// {{with pipeline}} itemList {{else}} itemList {{end}}
+//
// If keyword is past.
func (t *Tree) withControl() Node {
return t.newWith(t.parseControl(false, "with"))
}
// End:
+//
// {{end}}
+//
// End keyword is past.
func (t *Tree) endControl() Node {
return t.newEnd(t.expect(itemRightDelim, "end").pos)
}
// Else:
+//
// {{else}}
+//
// Else keyword is past.
func (t *Tree) elseControl() Node {
// Special case for "else if".
@@ -596,7 +616,9 @@
}
// Block:
+//
// {{block stringValue pipeline}}
+//
// Block keyword is past.
// The name must be something that can evaluate to a string.
// The pipeline is mandatory.
@@ -624,7 +646,9 @@
}
// Template:
+//
// {{template stringValue pipeline}}
+//
// Template keyword is past. The name must be something that can evaluate
// to a string.
func (t *Tree) templateControl() Node {
@@ -655,7 +679,9 @@
}
// command:
+//
// operand (space operand)*
+//
// space-separated arguments up to a pipeline character or right delimiter.
// we consume the pipe character but leave the right delim to terminate the action.
func (t *Tree) command() *CommandNode {
@@ -685,7 +711,9 @@
}
// operand:
+//
// term .Field*
+//
// An operand is a space-separated component of a command,
// a term possibly followed by field accesses.
// A nil return means the next item is not an operand.
@@ -719,12 +747,14 @@
}
// term:
+//
// literal (number, string, nil, boolean)
// function (identifier)
// .
// .Field
// $
// '(' pipeline ')'
+//
// A term is a simple "expression".
// A nil return means the next item is not a term.
func (t *Tree) term() Node {
diff --git a/internal/dl/dl.go b/internal/dl/dl.go
index cff8914..8d6013f 100644
--- a/internal/dl/dl.go
+++ b/internal/dl/dl.go
@@ -9,17 +9,20 @@
// It is designed to run only on the instance of godoc that serves golang.org.
//
// The package also serves the list of downloads and individual files at:
-// https://golang.org/dl/
-// https://golang.org/dl/{file}
+//
+// https://golang.org/dl/
+// https://golang.org/dl/{file}
//
// An optional query param, mode=json, serves the list of stable release
// downloads in JSON format:
-// https://golang.org/dl/?mode=json
+//
+// https://golang.org/dl/?mode=json
//
// An additional query param, include=all, when used with the mode=json
// query param, will serve a full list of available downloads, including
// unstable, stable, and archived releases, in JSON format:
-// https://golang.org/dl/?mode=json&include=all
+//
+// https://golang.org/dl/?mode=json&include=all
//
// Releases returned in JSON modes are sorted by version, newest to oldest.
package dl
diff --git a/internal/dl/server.go b/internal/dl/server.go
index 421c9d5..e9d0dde 100644
--- a/internal/dl/server.go
+++ b/internal/dl/server.go
@@ -79,6 +79,7 @@
}
// dl.gob was generated 2021-11-08 from the live server data, for offline testing.
+//
//go:embed dl.gob
var dlGob []byte
diff --git a/internal/history/history.go b/internal/history/history.go
index 4a2d985..e25485c 100644
--- a/internal/history/history.go
+++ b/internal/history/history.go
@@ -147,18 +147,17 @@
//
// The different special cases are:
//
-// c1
-// c1 and c2
-// c1, c2, and c3
+// c1
+// c1 and c2
+// c1, c2, and c3
//
-// the p1 package
-// the p1 and p2 packages
-// the p1, p2, and p3 packages
+// the p1 package
+// the p1 and p2 packages
+// the p1, p2, and p3 packages
//
-// c1 and [1 package]
-// c1, and [2 or more packages]
-// c1, c2, and [1 or more packages]
-//
+// c1 and [1 package]
+// c1, and [2 or more packages]
+// c1, c2, and [1 or more packages]
func (f *FixSummary) ComponentsAndPackages() template.HTML {
var buf strings.Builder
diff --git a/internal/screentest/screentest.go b/internal/screentest/screentest.go
index bca7a8e..21912c0 100644
--- a/internal/screentest/screentest.go
+++ b/internal/screentest/screentest.go
@@ -5,7 +5,7 @@
// Package screentest implements script-based visual diff testing
// for webpages.
//
-// Scripts
+// # Scripts
//
// A script is a template file containing a sequence of testcases, separated by
// blank lines. Lines beginning with # characters are ignored as comments. A
@@ -13,99 +13,98 @@
// with the dimensions of the screenshots to be compared. For example, here is
// a trivial script:
//
-// compare https://go.dev {{.ComparisonURL}}
-// pathname /about
-// capture fullscreen
+// compare https://go.dev {{.ComparisonURL}}
+// pathname /about
+// capture fullscreen
//
// This script has a single testcase. The first line sets the origin servers to
// compare. The second line sets the page to visit at each origin. The last line
// captures fullpage screenshots of the pages and generates a diff image if they
// do not match.
//
-// Keywords
+// # Keywords
//
// Use windowsize WIDTHxHEIGHT to set the default window size for all testcases
// that follow.
//
-// windowsize 540x1080
+// windowsize 540x1080
//
// Use compare ORIGIN ORIGIN to set the origins to compare.
//
-// compare https://go.dev http://localhost:6060
+// compare https://go.dev http://localhost:6060
//
// Use header KEY:VALUE to add headers to requests
//
-// header Authorization: Bearer token
+// header Authorization: Bearer token
//
// Add the ::cache suffix to cache the images from an origin for subsequent
// test runs.
//
-// compare https://go.dev::cache http://localhost:6060
+// compare https://go.dev::cache http://localhost:6060
//
// Use block URL ... to set URL patterns to block. Wildcards ('*') are allowed.
//
-// block https://codecov.io/* https://travis-ci.com/*
+// block https://codecov.io/* https://travis-ci.com/*
//
// Use output DIRECTORY to set the output directory for diffs and cached images.
//
-// output testdata/snapshots
+// output testdata/snapshots
//
// USE output BUCKETNAME for screentest to upload test output to a Cloud Storage bucket.
// The bucket must already exist prior to running the tests.
//
-// output gs://bucket-name
+// output gs://bucket-name
//
// Values set with the keywords above apply to all testcases that follow. Values set with
// the keywords below reset each time the test keyword is used.
//
// Use test NAME to create a name for the testcase.
//
-// test about page
+// test about page
//
// Use pathname PATH to set the page to visit at each origin. If no
// test name is set, PATH will be used as the name for the test.
//
-// pathname /about
+// pathname /about
//
// Use status CODE to set an expected HTTP status code. The default is 200.
//
-// status 404
+// status 404
//
// Use click SELECTOR to add a click an element on the page.
//
-// click button.submit
+// click button.submit
//
// Use wait SELECTOR to wait for an element to appear.
//
-// wait [role="treeitem"][aria-expanded="true"]
+// wait [role="treeitem"][aria-expanded="true"]
//
// Use capture [SIZE] [ARG] to create a testcase with the properties
// defined above.
//
-// capture fullscreen 540x1080
+// capture fullscreen 540x1080
//
// When taking an element screenshot provide a selector.
//
-// capture element header
+// capture element header
//
// Chain capture commands to create multiple testcases for a single page.
//
-// windowsize 1536x960
-// compare https://go.dev::cache http://localhost:6060
-// output testdata/snapshots
+// windowsize 1536x960
+// compare https://go.dev::cache http://localhost:6060
+// output testdata/snapshots
//
-// test homepage
-// pathname /
-// capture viewport
-// capture viewport 540x1080
-// capture viewport 400x1000
+// test homepage
+// pathname /
+// capture viewport
+// capture viewport 540x1080
+// capture viewport 400x1000
//
-// test about page
-// pathname /about
-// capture viewport
-// capture viewport 540x1080
-// capture viewport 400x1000
-//
+// test about page
+// pathname /about
+// capture viewport
+// capture viewport 540x1080
+// capture viewport 400x1000
package screentest
import (
diff --git a/internal/short/short.go b/internal/short/short.go
index 44a69a2..8cbbb59 100644
--- a/internal/short/short.go
+++ b/internal/short/short.go
@@ -54,7 +54,9 @@
}
// linkHandler services requests to short URLs.
-// https://go.dev/s/key[/remaining/path]
+//
+// https://go.dev/s/key[/remaining/path]
+//
// It consults memcache and datastore for the Link for key.
// It then sends a redirects or an error message.
// If the remaining path part is not empty, the redirects
diff --git a/internal/tmplfunc/tmpl.go b/internal/tmplfunc/tmpl.go
index 0659d89..63ab5a2 100644
--- a/internal/tmplfunc/tmpl.go
+++ b/internal/tmplfunc/tmpl.go
@@ -18,7 +18,7 @@
//
// {{template "link" (dict "url" "https://golang.org" "text" "the Go language")}}
//
-// Function Definitions
+// # Function Definitions
//
// The function installed for a given template depends on the name of the
// defined template, which can include not just a function name but also
@@ -52,9 +52,9 @@
//
// {{define "link url text?"}}<a href="{{.url}}">{{or .text .url}}</a>{{end}}
//
-// The Go home page is {{link "https://golang.org"}}.
+// The Go home page is {{link "https://golang.org"}}.
//
-// Usage
+// # Usage
//
// This package is meant to be used with templates from either the
// text/template or html/template packages. Given a *template.Template
diff --git a/internal/web/site.go b/internal/web/site.go
index f6269b0..e1fba85 100644
--- a/internal/web/site.go
+++ b/internal/web/site.go
@@ -5,7 +5,7 @@
// Package web implements a basic web site serving framework.
// The two fundamental types in this package are Site and Page.
//
-// Sites
+// # Sites
//
// A Site is an http.Handler that serves requests from a file system.
// Use NewSite(fsys) to create a new Site.
@@ -14,7 +14,7 @@
// which holds files to be served as well as templates for
// converting Markdown or HTML fragments into full HTML pages.
//
-// Pages
+// # Pages
//
// A Page, which is a map[string]interface{}, is the raw data that a Site renders into a web page.
// Typically a Page is loaded from a *.html or *.md file in the file system fsys, although
@@ -54,14 +54,14 @@
// In addition to these explicit key-value pairs, pages loaded from the file system
// have a few implicit key-value pairs added by the page loading process:
//
-// - File: the path in fsys to the file containing the page
-// - FileData: the file body, with the key-value metadata stripped
-// - URL: this page's URL path (/x/y/z for x/y/z.md, /x/y/ for x/y/index.md)
+// - File: the path in fsys to the file containing the page
+// - FileData: the file body, with the key-value metadata stripped
+// - URL: this page's URL path (/x/y/z for x/y/z.md, /x/y/ for x/y/index.md)
//
// The key “Content” is added during during the rendering process.
// See “Page Rendering” for details.
//
-// Page Rendering
+// # Page Rendering
//
// A Page's content is rendered in two steps: conversion to content, and framing of content.
//
@@ -106,7 +106,7 @@
// if there is no layout-specific template,
// the content will still be rendered.
//
-// Page Template Functions
+// # Page Template Functions
//
// In this web server, templates can themselves be invoked as functions.
// See https://pkg.go.dev/rsc.io/tmplfunc for more details about that feature.
@@ -194,7 +194,7 @@
// function in these packages (except path.Split, which has more than one non-error result
// and would not be invokable). For example, “{{strings.ToUpper "abc"}}”.
//
-// Serving Requests
+// # Serving Requests
//
// A Site is an http.Handler that serves requests by consulting the underlying
// file system and constructing and rendering pages, as well as serving binary
@@ -270,7 +270,7 @@
// where err is the “not exist” error returned by fs.Stat(fsys, p).
// (See also the “Serving Errors” section below.)
//
-// Serving Dynamic Requests
+// # Serving Dynamic Requests
//
// Of course, a web site may wish to serve more than static content.
// To allow dynamically generated web pages to make use of page
@@ -278,7 +278,7 @@
// called with a dynamically generated Page value, which will then
// be rendered and served as the result of the request.
//
-// Serving Errors
+// # Serving Errors
//
// If an error occurs while serving a request r,
// the Site responds with the rendering of
@@ -295,7 +295,6 @@
//
// The Site.ServeError and Site.ServeErrorStatus methods provide a way
// for dynamic servers to generate similar responses.
-//
package web
import (
@@ -378,7 +377,6 @@
// "layout": error,
// "error": err,
// }
-//
func (s *Site) ServeErrorStatus(w http.ResponseWriter, r *http.Request, err error, status int) {
s.serveErrorStatus(w, r, err, status, false)
}
diff --git a/internal/webtest/webtest.go b/internal/webtest/webtest.go
index 86bd868..cdd22c8 100644
--- a/internal/webtest/webtest.go
+++ b/internal/webtest/webtest.go
@@ -21,7 +21,7 @@
// They run the entire script and return a multiline error summarizing
// any problems.
//
-// Scripts
+// # Scripts
//
// A script is a text file containing a sequence of cases, separated by blank lines.
// Lines beginning with # characters are ignored as comments.
@@ -36,7 +36,7 @@
// In this case, the request is a GET of the URL /, and the response body
// must contain the text “Go is an open source programming language”.
//
-// Requests
+// # Requests
//
// Each case begins with a line starting with GET, HEAD, or POST.
// The argument (the remainder of the line) is the URL to be used in the request.
@@ -79,7 +79,7 @@
// This stanza sends a request with post body “x=hello+world&y=Go+%26+You”.
// (The multiline syntax is described in detail below.)
//
-// Checks
+// # Checks
//
// By default, a stanza like the ones above checks only that the request
// succeeds in returning a response with HTTP status code 200 (OK).
@@ -130,7 +130,7 @@
// body ~ Got1xxResponse.*// Go 1\.11
// body ~ GotFirstResponseByte func\(\)\s*$
//
-// Multiline Texts
+// # Multiline Texts
//
// The <text> in a request or check line can take a multiline form,
// by omitting it from the original line and then specifying the text
@@ -145,7 +145,6 @@
// body ==
// <!DOCTYPE html>
// hello, world
-//
package webtest
import (
To view, visit change 399608. To unsubscribe, or for help writing mail filters, visit settings.
Russ Cox submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: I554ad01aa12e84301e44e15c3dc04f82c7244efb
Reviewed-on: https://go-review.googlesource.com/c/xerrors/+/399609
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M doc.go
M wrap_113_test.go
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/doc.go b/doc.go
index eef99d9..2ef99f5 100644
--- a/doc.go
+++ b/doc.go
@@ -5,7 +5,8 @@
// Package xerrors implements functions to manipulate errors.
//
// This package is based on the Go 2 proposal for error values:
-// https://golang.org/design/29934-error-values
+//
+// https://golang.org/design/29934-error-values
//
// These functions were incorporated into the standard library's errors package
// in Go 1.13:
diff --git a/wrap_113_test.go b/wrap_113_test.go
index 25c3d80..48fedb5 100644
--- a/wrap_113_test.go
+++ b/wrap_113_test.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//+build go1.13
+//go:build go1.13
+// +build go1.13
package xerrors_test
To view, visit change 399609. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ibc40b6ada59a562e31a363dbe15e05d5f246874c
Reviewed-on: https://go-review.googlesource.com/c/perf/+/399600
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Michael Pratt <mpr...@google.com>
---
M analysis/app/parse.go
M analysis/app/trend.go
M analysis/localperf/app.go
M benchfmt/internal/bytesconv/atof.go
M benchproc/keyheader.go
M benchproc/syntax/doc.go
M benchseries/benchseries.go
M cmd/benchsave/benchsave.go
M cmd/benchstat/main.go
M storage/benchfmt/benchfmt.go
M storage/client.go
M storage/cmd/reindex/reindex.go
M storage/db/db.go
M storage/localperfdata/app.go
14 files changed, 142 insertions(+), 115 deletions(-)
diff --git a/analysis/app/parse.go b/analysis/app/parse.go
index 0286a8f..4afc3d7 100644
--- a/analysis/app/parse.go
+++ b/analysis/app/parse.go
@@ -8,9 +8,11 @@
// parseQueryString splits a user-entered query into one or more storage server queries.
// The supported query formats are:
-// prefix | one vs two - parsed as "prefix", {"one", "two"}
-// prefix one vs two - parsed as "", {"prefix one", "two"}
-// anything else - parsed as "", {"anything else"}
+//
+// prefix | one vs two - parsed as "prefix", {"one", "two"}
+// prefix one vs two - parsed as "", {"prefix one", "two"}
+// anything else - parsed as "", {"anything else"}
+//
// The vs and | separators must not be quoted.
func parseQueryString(q string) (string, []string) {
var queries []string
diff --git a/analysis/app/trend.go b/analysis/app/trend.go
index dfda67a..312fff6 100644
--- a/analysis/app/trend.go
+++ b/analysis/app/trend.go
@@ -321,12 +321,16 @@
// aggResults pivots the table, taking the columns in Values and making a new column for each distinct value in Across.
// aggResults("in", []string{"value1", "value2"} will reshape a table like
-// in value1 value2
-// one 1 2
-// two 3 4
+//
+// in value1 value2
+// one 1 2
+// two 3 4
+//
// and will turn in into a table like
-// one/value1 one/value2 two/value1 two/value2
-// 1 2 3 4
+//
+// one/value1 one/value2 two/value1 two/value2
+// 1 2 3 4
+//
// across columns must be []string, and value columns must be []float64.
type aggResults struct {
// Across is the name of the column whose values are the column prefix.
diff --git a/analysis/localperf/app.go b/analysis/localperf/app.go
index a82b0c9..61b0cbe 100644
--- a/analysis/localperf/app.go
+++ b/analysis/localperf/app.go
@@ -6,7 +6,7 @@
//
// Usage:
//
-// localperf [-addr address] [-storage url] [-base_dir ../appengine]
+// localperf [-addr address] [-storage url] [-base_dir ../appengine]
package main
import (
diff --git a/benchfmt/internal/bytesconv/atof.go b/benchfmt/internal/bytesconv/atof.go
index 5ffdbaa..31b26f5 100644
--- a/benchfmt/internal/bytesconv/atof.go
+++ b/benchfmt/internal/bytesconv/atof.go
@@ -407,9 +407,11 @@
// If possible to convert decimal representation to 64-bit float f exactly,
// entirely in floating-point math, do so, avoiding the expense of decimalToFloatBits.
// Three common cases:
+//
// value is exact integer
// value is exact integer * exact power of ten
// value is exact integer / exact power of ten
+//
// These all produce potentially inexact but correctly rounded answers.
func atof64exact(mantissa uint64, exp int, neg bool) (f float64, ok bool) {
if mantissa>>float64info.mantbits != 0 {
diff --git a/benchproc/keyheader.go b/benchproc/keyheader.go
index 42ee375..721b092 100644
--- a/benchproc/keyheader.go
+++ b/benchproc/keyheader.go
@@ -17,19 +17,19 @@
//
// For example, given four keys:
//
-// K[0] = a:1 b:1 c:1
-// K[1] = a:1 b:1 c:2
-// K[2] = a:2 b:2 c:2
-// K[3] = a:2 b:3 c:3
+// K[0] = a:1 b:1 c:1
+// K[1] = a:1 b:1 c:2
+// K[2] = a:2 b:2 c:2
+// K[3] = a:2 b:3 c:3
//
// the KeyHeader is as follows:
//
-// Level 0 a:1 a:2
-// | / \
-// Level 1 b:1 b:2 b:3
-// / \ | |
-// Level 2 c:1 c:2 c:2 c:3
-// K[0] K[1] K[2] K[3]
+// Level 0 a:1 a:2
+// | / \
+// Level 1 b:1 b:2 b:3
+// / \ | |
+// Level 2 c:1 c:2 c:2 c:3
+// K[0] K[1] K[2] K[3]
type KeyHeader struct {
// Keys is the sequence of keys at the leaf level of this tree.
// Each level subdivides this sequence.
diff --git a/benchproc/syntax/doc.go b/benchproc/syntax/doc.go
index 160e5f0..81afcdd 100644
--- a/benchproc/syntax/doc.go
+++ b/benchproc/syntax/doc.go
@@ -11,7 +11,7 @@
// several field, including a name, name-based configuration, and
// file configuration pairs ("key: value" lines).
//
-// Keys
+// # Keys
//
// Filters and projections share a common set of keys for referring to
// these fields of a benchmark result:
@@ -54,45 +54,45 @@
// - ".file" refers to the input file provided on the command line
// (for command-line tools that use benchfmt.Files).
//
-// Filters
+// # Filters
//
// Filters are boolean expressions that match or exclude benchmark
// results or individual measurements.
//
// Filters are built from key-value terms:
//
-// key:value - Match if key's value is exactly "value".
-// key:"value" - Same, but value is a double-quoted Go string that
-// may contain spaces or other special characters.
-// "key":value - Keys may also be double-quoted.
-// key:/regexp/ - Match if key's value matches a regular expression.
-// key:(val1 OR val2 OR ...)
-// - Short-hand for key:val1 OR key:val2. Values may be
-// double-quoted strings or regexps.
-// * - Match everything.
+// key:value - Match if key's value is exactly "value".
+// key:"value" - Same, but value is a double-quoted Go string that
+// may contain spaces or other special characters.
+// "key":value - Keys may also be double-quoted.
+// key:/regexp/ - Match if key's value matches a regular expression.
+// key:(val1 OR val2 OR ...)
+// - Short-hand for key:val1 OR key:val2. Values may be
+// double-quoted strings or regexps.
+// * - Match everything.
//
// These terms can be combined into larger expressions as follows:
//
-// x y ... - Match if x, y, etc. all match.
-// x AND y - Same as x y.
-// x OR y - Match if x or y match.
-// -x - Match if x does not match.
-// (...) - Subexpression.
+// x y ... - Match if x, y, etc. all match.
+// x AND y - Same as x y.
+// x OR y - Match if x or y match.
+// -x - Match if x does not match.
+// (...) - Subexpression.
//
// Precise syntax:
//
-// expr = andExpr {"OR" andExpr}
-// andExpr = match {"AND"? match}
-// match = "(" expr ")"
-// | "-" match
-// | "*"
-// | key ":" value
-// | key ":" "(" value {"OR" value} ")"
-// key = word
-// value = word
-// | "/" regexp "/"
+// expr = andExpr {"OR" andExpr}
+// andExpr = match {"AND"? match}
+// match = "(" expr ")"
+// | "-" match
+// | "*"
+// | key ":" value
+// | key ":" "(" value {"OR" value} ")"
+// key = word
+// value = word
+// | "/" regexp "/"
//
-// Projections
+// # Projections
//
// A projection expresses how to extract a tuple of data from a
// benchmark result, as well as a sort order for projected tuples.
@@ -115,18 +115,18 @@
//
// Precise syntax:
//
-// expr = part {","? part}
-// part = key
-// | key "@" order
-// | key "@" "(" word {word} ")"
-// key = word
-// order = word
+// expr = part {","? part}
+// part = key
+// | key "@" order
+// | key "@" "(" word {word} ")"
+// key = word
+// order = word
//
-// Common syntax
+// # Common syntax
//
// Filters and projections share the following common base syntax:
//
-// word = bareWord
-// | double-quoted Go string
-// bareWord = [^-*"():@,][^ ():@,]*
+// word = bareWord
+// | double-quoted Go string
+// bareWord = [^-*"():@,][^ ():@,]*
package syntax
diff --git a/benchseries/benchseries.go b/benchseries/benchseries.go
index 889c490..8b7f110 100644
--- a/benchseries/benchseries.go
+++ b/benchseries/benchseries.go
@@ -844,8 +844,9 @@
// KSov returns the size-adjusted Kolmogorov-Smirnov statistic,
// equal to D_{n,m} / sqrt((n+m)/n*m). The result can be compared
// to c(α) where α is the level at which the null hypothesis is rejected.
-// α: 0.2 0.15 0.10 0.05 0.025 0.01 0.005 0.001
-// c(α): 1.073 1.138 1.224 1.358 1.48 1.628 1.731 1.949
+//
+// α: 0.2 0.15 0.10 0.05 0.025 0.01 0.005 0.001
+// c(α): 1.073 1.138 1.224 1.358 1.48 1.628 1.731 1.949
//
// see
// https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test#Two-sample_Kolmogorov%E2%80%93Smirnov_test
diff --git a/cmd/benchsave/benchsave.go b/cmd/benchsave/benchsave.go
index 6474b61..51f32c4 100644
--- a/cmd/benchsave/benchsave.go
+++ b/cmd/benchsave/benchsave.go
@@ -9,7 +9,7 @@
// benchsave [-v] [-header file] [-server url] file...
//
// Each input file should contain the output from one or more runs of
-// ``go test -bench'', or another tool which uses the same format.
+// “go test -bench”, or another tool which uses the same format.
//
// Benchsave will upload the input files to the specified server and
// print a URL where they can be viewed.
diff --git a/cmd/benchstat/main.go b/cmd/benchstat/main.go
index b882c06..84f3849 100644
--- a/cmd/benchstat/main.go
+++ b/cmd/benchstat/main.go
@@ -9,7 +9,7 @@
// benchstat [-delta-test name] [-geomean] [-html] [-sort order] old.txt [new.txt] [more.txt ...]
//
// Each input file should contain the concatenated output of a number
-// of runs of ``go test -bench.'' For each different benchmark listed in an input file,
+// of runs of “go test -bench.” For each different benchmark listed in an input file,
// benchstat computes the mean, minimum, and maximum run time,
// after removing outliers using the interquartile range rule.
//
@@ -41,9 +41,9 @@
// none (input order), delta (percent improvement), or name (benchmark name).
// A leading “-” prefix, as in “-delta”, reverses the order.
//
-// Example
+// # Example
//
-// Suppose we collect benchmark results from running ``go test -bench=Encode''
+// Suppose we collect benchmark results from running “go test -bench=Encode”
// five times before and after a particular change.
//
// The file old.txt contains:
@@ -91,7 +91,6 @@
//
// Note that the JSONEncode result is reported as
// statistically insignificant instead of a -0.93% delta.
-//
package main
import (
diff --git a/storage/benchfmt/benchfmt.go b/storage/benchfmt/benchfmt.go
index 33eb3fa..2ea4288 100644
--- a/storage/benchfmt/benchfmt.go
+++ b/storage/benchfmt/benchfmt.go
@@ -28,13 +28,13 @@
// Reader reads benchmark results from an io.Reader.
// Use Next to advance through the results.
//
-// br := benchfmt.NewReader(r)
-// for br.Next() {
-// res := br.Result()
-// ...
-// }
-// err = br.Err() // get any error encountered during iteration
-// ...
+// br := benchfmt.NewReader(r)
+// for br.Next() {
+// res := br.Result()
+// ...
+// }
+// err = br.Err() // get any error encountered during iteration
+// ...
type Reader struct {
s *bufio.Scanner
labels Labels
diff --git a/storage/client.go b/storage/client.go
index 5519387..eee6439 100644
--- a/storage/client.go
+++ b/storage/client.go
@@ -69,15 +69,15 @@
// A Query allows iteration over the results of a search query.
// Use Next to advance through the results, making sure to call Close when done:
//
-// q := client.Query("key:value")
-// defer q.Close()
-// for q.Next() {
-// res := q.Result()
-// ...
-// }
-// if err = q.Err(); err != nil {
-// // handle error encountered during query
-// }
+// q := client.Query("key:value")
+// defer q.Close()
+// for q.Next() {
+// res := q.Result()
+// ...
+// }
+// if err = q.Err(); err != nil {
+// // handle error encountered during query
+// }
type Query struct {
br *benchfmt.Reader
body io.ReadCloser
@@ -160,15 +160,15 @@
// UploadList is the result of ListUploads.
// Use Next to advance through the rows, making sure to call Close when done:
//
-// q := db.ListUploads("key:value")
-// defer q.Close()
-// for q.Next() {
-// id, count := q.Row()
-// labels := q.LabelValues()
-// ...
-// }
-// err = q.Err() // get any error encountered during iteration
-// ...
+// q := db.ListUploads("key:value")
+// defer q.Close()
+// for q.Next() {
+// id, count := q.Row()
+// labels := q.LabelValues()
+// ...
+// }
+// err = q.Err() // get any error encountered during iteration
+// ...
type UploadList struct {
body io.Closer
dec *json.Decoder
@@ -267,16 +267,16 @@
// An Upload is an in-progress upload.
// Use CreateFile to upload one or more files, then call Commit or Abort.
//
-// u := client.NewUpload()
-// w, err := u.CreateFile()
-// if err != nil {
-// u.Abort()
-// return err
-// }
-// fmt.Fprintf(w, "BenchmarkResult 1 1 ns/op\n")
-// if err := u.Commit(); err != nil {
-// return err
-// }
+// u := client.NewUpload()
+// w, err := u.CreateFile()
+// if err != nil {
+// u.Abort()
+// return err
+// }
+// fmt.Fprintf(w, "BenchmarkResult 1 1 ns/op\n")
+// if err := u.Commit(); err != nil {
+// return err
+// }
type Upload struct {
pw io.WriteCloser
mpw *multipart.Writer
diff --git a/storage/cmd/reindex/reindex.go b/storage/cmd/reindex/reindex.go
index 2193745..7ab7cbe 100644
--- a/storage/cmd/reindex/reindex.go
+++ b/storage/cmd/reindex/reindex.go
@@ -10,6 +10,7 @@
//
// Reindex reindexes all the uploads with IDs starting with the given prefixes.
+//go:build cloud
// +build cloud
package main
diff --git a/storage/db/db.go b/storage/db/db.go
index d5674eb..1d92d24 100644
--- a/storage/db/db.go
+++ b/storage/db/db.go
@@ -437,14 +437,14 @@
// Query is the result of a query.
// Use Next to advance through the rows, making sure to call Close when done:
//
-// q := db.Query("key:value")
-// defer q.Close()
-// for q.Next() {
-// res := q.Result()
-// ...
-// }
-// err = q.Err() // get any error encountered during iteration
-// ...
+// q := db.Query("key:value")
+// defer q.Close()
+// for q.Next() {
+// res := q.Result()
+// ...
+// }
+// err = q.Err() // get any error encountered during iteration
+// ...
type Query struct {
rows *sql.Rows
// for Debug
@@ -544,14 +544,14 @@
// UploadList is the result of ListUploads.
// Use Next to advance through the rows, making sure to call Close when done:
//
-// q := db.ListUploads("key:value")
-// defer q.Close()
-// for q.Next() {
-// info := q.Info()
-// ...
-// }
-// err = q.Err() // get any error encountered during iteration
-// ...
+// q := db.ListUploads("key:value")
+// defer q.Close()
+// for q.Next() {
+// info := q.Info()
+// ...
+// }
+// err = q.Err() // get any error encountered during iteration
+// ...
type UploadList struct {
rows *sql.Rows
extraLabels []string
diff --git a/storage/localperfdata/app.go b/storage/localperfdata/app.go
index bcd590d..691274b 100644
--- a/storage/localperfdata/app.go
+++ b/storage/localperfdata/app.go
@@ -9,7 +9,7 @@
//
// Usage:
//
-// localperfdata [-addr address] [-view_url_base url] [-base_dir ../appengine] [-dsn file.db]
+// localperfdata [-addr address] [-view_url_base url] [-base_dir ../appengine] [-dsn file.db]
package main
import (
To view, visit change 399600. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ia9e71e7ecac75822ff43d6c7e60f512442a5fa50
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/399617
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: kokoro <noreply...@google.com>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Jonathan Amsterdam <j...@google.com>
---
M cmd/pkgsite/main.go
M devtools/cmd/seeddb/main.go
M internal/database/database.go
M internal/database/reflect.go
M internal/dcensus/dcensus.go
M internal/discovery.go
M internal/fetch/package.go
M internal/frontend/latest_version.go
M internal/frontend/overview.go
M internal/frontend/readme.go
M internal/frontend/urlinfo.go
M internal/frontend/versions.go
M internal/godoc/codec/codec_test.go
M internal/godoc/codec/doc.go
M internal/godoc/dochtml/internal/render/linkify.go
M internal/godoc/dochtml/internal/render/render.go
M internal/godoc/internal/doc/comment.go
M internal/godoc/internal/doc/doc.go
M internal/godoc/internal/doc/example.go
M internal/godoc/internal/doc/exports.go
M internal/godoc/internal/doc/filter.go
M internal/godoc/internal/doc/reader.go
M internal/godoc/internal/doc/synopsis.go
M internal/licenses/licenses.go
M internal/middleware/stats.go
M internal/postgres/search.go
M internal/postgres/searchdoc.go
M internal/postgres/test_helper.go
M internal/postgres/unit.go
M internal/source/source.go
M internal/stdlib/stdlib.go
M internal/symbol/generate.go
M internal/testing/sample/sample.go
M internal/version/version.go
M internal/worker/server.go
35 files changed, 177 insertions(+), 154 deletions(-)
diff --git a/cmd/pkgsite/main.go b/cmd/pkgsite/main.go
index 0ec7626..d4ccf27 100644
--- a/cmd/pkgsite/main.go
+++ b/cmd/pkgsite/main.go
@@ -11,7 +11,7 @@
// With no arguments, pkgsite will serve docs for the module in the current
// directory, which must have a go.mod file:
//
-// cd ~/repos/cue && pkgsite
+// cd ~/repos/cue && pkgsite
//
// This form will also serve all of the module's required modules at their
// required versions. You can disable serving the required modules by passing
@@ -20,13 +20,13 @@
// You can also serve docs from your module cache, directly from the proxy
// (it uses the GOPROXY environment variable), or both:
//
-// pkgsite -cache -proxy
+// pkgsite -cache -proxy
//
// With either -cache or -proxy, pkgsite won't look for a module in the current
// directory. You can still provide modules on the local filesystem by listing
// their paths:
//
-// pkgsite -cache -proxy ~/repos/cue some/other/module
+// pkgsite -cache -proxy ~/repos/cue some/other/module
//
// Although standard library packages will work by default, the docs can take a
// while to appear the first time because the Go repo must be cloned and
diff --git a/devtools/cmd/seeddb/main.go b/devtools/cmd/seeddb/main.go
index 047d8d2..d729ca6 100644
--- a/devtools/cmd/seeddb/main.go
+++ b/devtools/cmd/seeddb/main.go
@@ -230,7 +230,8 @@
// readSeedFile reads a file of module versions that we want to fetch for
// seeding the database. Each line of the file should be of the form:
-// module@version
+//
+// module@version
func readSeedFile(ctx context.Context, seedfile string) (_ []internal.Modver, err error) {
defer derrors.Wrap(&err, "readSeedFile %q", seedfile)
lines, err := internal.ReadFileLines(seedfile)
diff --git a/internal/database/database.go b/internal/database/database.go
index e90bfbe..b636375 100644
--- a/internal/database/database.go
+++ b/internal/database/database.go
@@ -321,7 +321,9 @@
// BulkInsert constructs and executes a multi-value insert statement. The
// query is constructed using the format:
-// INSERT INTO <table> (<columns>) VALUES (<placeholders-for-each-item-in-values>)
+//
+// INSERT INTO <table> (<columns>) VALUES (<placeholders-for-each-item-in-values>)
+//
// If conflictAction is not empty, it is appended to the statement.
//
// The query is executed using a PREPARE statement with the provided values.
@@ -478,7 +480,8 @@
// the values of the first column.
//
// Types holds the database type of each column. For example,
-// []string{"INT", "TEXT"}
+//
+// []string{"INT", "TEXT"}
//
// Values contains one slice of values per column. (Note that this is unlike BulkInsert, which
// takes a single slice of interleaved values.)
diff --git a/internal/database/reflect.go b/internal/database/reflect.go
index c48aaaf..e057d06 100644
--- a/internal/database/reflect.go
+++ b/internal/database/reflect.go
@@ -26,16 +26,17 @@
// to a struct.
//
// Example:
-// type Player struct { Name string; Score int }
-// playerScanArgs := database.StructScanner(Player{})
-// err := db.RunQuery(ctx, "SELECT name, score FROM players", func(rows *sql.Rows) error {
-// var p Player
-// if err := rows.Scan(playerScanArgs(&p)...); err != nil {
-// return err
-// }
-// // use p
-// return nil
-// })
+//
+// type Player struct { Name string; Score int }
+// playerScanArgs := database.StructScanner(Player{})
+// err := db.RunQuery(ctx, "SELECT name, score FROM players", func(rows *sql.Rows) error {
+// var p Player
+// if err := rows.Scan(playerScanArgs(&p)...); err != nil {
+// return err
+// }
+// // use p
+// return nil
+// })
func StructScanner[T any]() func(p *T) []interface{} {
return structScannerForType[T]()
}
@@ -121,9 +122,10 @@
// CollectStructs scans the the rows from the query into structs and returns a slice of them.
// Example:
-// type Player struct { Name string; Score int }
-// var players []Player
-// err := db.CollectStructs(ctx, &players, "SELECT name, score FROM players")
+//
+// type Player struct { Name string; Score int }
+// var players []Player
+// err := db.CollectStructs(ctx, &players, "SELECT name, score FROM players")
func CollectStructs[T any](ctx context.Context, db *DB, query string, args ...interface{}) ([]T, error) {
scanner := structScannerForType[T]()
var ts []T
diff --git a/internal/dcensus/dcensus.go b/internal/dcensus/dcensus.go
index b68b4e3..92890ce 100644
--- a/internal/dcensus/dcensus.go
+++ b/internal/dcensus/dcensus.go
@@ -209,11 +209,11 @@
}
// Customizations of ochttp views. Views are updated as follows:
-// + ClientHost and ServerRoute are added to resp. client and server metrics.
-// Since these are bounded cardinality in our metrics, they are useful to
-// add additional context.
-// + Method tags are removed. We don't have any routes that accept more than
-// one HTTP method.
+// - ClientHost and ServerRoute are added to resp. client and server metrics.
+// Since these are bounded cardinality in our metrics, they are useful to
+// add additional context.
+// - Method tags are removed. We don't have any routes that accept more than
+// one HTTP method.
var (
ServerRequestCount = &view.View{
Name: "go-discovery/http/server/request_count",
diff --git a/internal/discovery.go b/internal/discovery.go
index 2e54d3d..16e17d0 100644
--- a/internal/discovery.go
+++ b/internal/discovery.go
@@ -100,9 +100,10 @@
// MajorVersionForModule returns the final "vN" from the module path, if any.
// It returns the empty string if the module path is malformed.
// Examples:
-// "m.com" => ""
-// "m.com/v2" => "v2"
-// "gpkg.in/m.v1 = "v1"
+//
+// "m.com" => ""
+// "m.com/v2" => "v2"
+// "gpkg.in/m.v1 = "v1"
func MajorVersionForModule(modulePath string) string {
_, v, _ := module.SplitPathVersion(modulePath)
return strings.TrimLeft(v, "/.")
diff --git a/internal/fetch/package.go b/internal/fetch/package.go
index e6eca02..b536a1a 100644
--- a/internal/fetch/package.go
+++ b/internal/fetch/package.go
@@ -246,8 +246,8 @@
// The logic of the go tool for ignoring directories is documented at
// https://golang.org/cmd/go/#hdr-Package_lists_and_patterns:
//
-// Directory and file names that begin with "." or "_" are ignored
-// by the go tool, as are directories named "testdata".
+// Directory and file names that begin with "." or "_" are ignored
+// by the go tool, as are directories named "testdata".
//
// However, even though `go list` and other commands that take package
// wildcards will ignore these, they can still be imported and used in
diff --git a/internal/frontend/latest_version.go b/internal/frontend/latest_version.go
index e9fcb7f..e3e4b73 100644
--- a/internal/frontend/latest_version.go
+++ b/internal/frontend/latest_version.go
@@ -14,9 +14,10 @@
// GetLatestInfo returns various pieces of information about the latest
// versions of a unit and module:
-// - The linkable form of the minor version of the unit.
-// - The latest module path and the full unit path of any major version found given the
-// fullPath and the modulePath.
+// - The linkable form of the minor version of the unit.
+// - The latest module path and the full unit path of any major version found given the
+// fullPath and the modulePath.
+//
// It returns empty strings on error.
// It is intended to be used as an argument to middleware.LatestVersions.
func (s *Server) GetLatestInfo(ctx context.Context, unitPath, modulePath string, latestUnitMeta *internal.UnitMeta) internal.LatestInfo {
diff --git a/internal/frontend/overview.go b/internal/frontend/overview.go
index 47ede784..4012f1c 100644
--- a/internal/frontend/overview.go
+++ b/internal/frontend/overview.go
@@ -124,9 +124,13 @@
//
// In addition, GitHub will translate absolute non-raw links to image files to raw links.
// For example, when GitHub renders a README with
-// <img src="https://github.com/gobuffalo/buffalo/blob/master/logo.svg">
+//
+// <img src="https://github.com/gobuffalo/buffalo/blob/master/logo.svg">
+//
// it rewrites it to
-// <img src="https://github.com/gobuffalo/buffalo/raw/master/logo.svg">
+//
+// <img src="https://github.com/gobuffalo/buffalo/raw/master/logo.svg">
+//
// (replacing "blob" with "raw").
// We do that too.
func translateLink(dest string, info *source.Info, useRaw bool, readme *internal.Readme) string {
diff --git a/internal/frontend/readme.go b/internal/frontend/readme.go
index 60ff522..a54211e 100644
--- a/internal/frontend/readme.go
+++ b/internal/frontend/readme.go
@@ -61,7 +61,7 @@
// readme's original styling is preserved in the html by giving headings a css
// class styled identical to their original heading level.
//
-// The extracted links are for display outside of the readme contents.
+// The extracted links are for display outside of the readme contents.
//
// This function is exported for use by external tools.
func ProcessReadme(ctx context.Context, u *internal.Unit) (_ *Readme, err error) {
diff --git a/internal/frontend/urlinfo.go b/internal/frontend/urlinfo.go
index cadac79..5420dc6 100644
--- a/internal/frontend/urlinfo.go
+++ b/internal/frontend/urlinfo.go
@@ -65,19 +65,19 @@
// of three forms, and we divide it into three parts: a full path, a module
// path, and a version.
//
-// 1. The path has no '@', like github.com/hashicorp/vault/api.
-// This is the full path. The module path is unknown. So is the version, so we
-// treat it as the latest version for whatever the path denotes.
+// 1. The path has no '@', like github.com/hashicorp/vault/api.
+// This is the full path. The module path is unknown. So is the version, so we
+// treat it as the latest version for whatever the path denotes.
//
-// 2. The path has "@version" at the end, like github.com/hashicorp/vault/a...@v1.2.3.
-// We split this at the '@' into a full path (github.com/hashicorp/vault/api)
-// and version (v1.2.3); the module path is still unknown.
+// 2. The path has "@version" at the end, like github.com/hashicorp/vault/a...@v1.2.3.
+// We split this at the '@' into a full path (github.com/hashicorp/vault/api)
+// and version (v1.2.3); the module path is still unknown.
//
-// 3. The path has "@version" in the middle, like github.com/hashicorp/va...@v1.2.3/api.
-// (We call this the "canonical" form of a path.)
-// We remove the version to get the full path, which is again
-// github.com/hashicorp/vault/api. The version is v1.2.3, and the module path is
-// the part before the '@', github.com/hashicorp/vault.
+// 3. The path has "@version" in the middle, like github.com/hashicorp/va...@v1.2.3/api.
+// (We call this the "canonical" form of a path.)
+// We remove the version to get the full path, which is again
+// github.com/hashicorp/vault/api. The version is v1.2.3, and the module path is
+// the part before the '@', github.com/hashicorp/vault.
//
// In one case, we do a little more than parse the urlPath into parts: if the full path
// could be a part of the standard library (because it has no '.'), we assume it
diff --git a/internal/frontend/versions.go b/internal/frontend/versions.go
index 1c685df..28c4fe0 100644
--- a/internal/frontend/versions.go
+++ b/internal/frontend/versions.go
@@ -124,10 +124,11 @@
//
// For example: if we're considering package foo.com/v3/bar/baz, and encounter
// module version foo.com/bar/v2, we do the following:
-// 1) Start with the v1Path foo.com/bar/baz.
-// 2) Trim off the version series path foo.com/bar to get 'baz'.
-// 3) Join with the versioned module path foo.com/bar/v2 to get
-// foo.com/bar/v2/baz.
+// 1. Start with the v1Path foo.com/bar/baz.
+// 2. Trim off the version series path foo.com/bar to get 'baz'.
+// 3. Join with the versioned module path foo.com/bar/v2 to get
+// foo.com/bar/v2/baz.
+//
// ...being careful about slashes along the way.
func pathInVersion(v1Path string, mi *internal.ModuleInfo) string {
suffix := internal.Suffix(v1Path, mi.SeriesPath())
diff --git a/internal/godoc/codec/codec_test.go b/internal/godoc/codec/codec_test.go
index 61c9276..c93f941 100644
--- a/internal/godoc/codec/codec_test.go
+++ b/internal/godoc/codec/codec_test.go
@@ -265,7 +265,9 @@
}
// The following three functions were generated with
-// Generate(os.Stdout, "p", node{})
+//
+// Generate(os.Stdout, "p", node{})
+//
// and pasted here. They should be kept in sync
// with the output of Generate.
func encode_node(e *Encoder, x *node) {
diff --git a/internal/godoc/codec/doc.go b/internal/godoc/codec/doc.go
index 28980ba..b628b22 100644
--- a/internal/godoc/codec/doc.go
+++ b/internal/godoc/codec/doc.go
@@ -10,7 +10,7 @@
other pointer types or sub-slices). These features are sufficient for
encoding the structures of the go/ast package, which is its sole purpose.
-Encoding Scheme
+# Encoding Scheme
Every encoded value begins with a single byte that describes what (if
anything) follows. There is enough information to skip over the value, since
@@ -32,7 +32,8 @@
followed by N bytes of data. This is used to represent strings and byte
slices, as well numbers bigger than can fit into the initial byte. For
example, the string "hi" is represented as:
- nBytes 2 'h' 'i'
+
+ nBytes 2 'h' 'i'
Unsigned integers that can't fit into the initial byte are encoded as byte
sequences of length 4 or 8, holding little-endian uint32 or uint64 values. We
@@ -43,7 +44,8 @@
The nValues code is for sequences of values whose size is known beforehand,
like a Go slice or array. The slice []string{"hi", "bye"} is encoded as
- nValues 2 nBytes 2 'h' 'i' nBytes 3 'b' 'y' 'e'
+
+ nValues 2 nBytes 2 'h' 'i' nBytes 3 'b' 'y' 'e'
The ref code is used to refer to an earlier encoded value. It is followed by
a uint denoting the index data of the value to use.
diff --git a/internal/godoc/dochtml/internal/render/linkify.go b/internal/godoc/dochtml/internal/render/linkify.go
index 9e33743..cd9cdc7 100644
--- a/internal/godoc/dochtml/internal/render/linkify.go
+++ b/internal/godoc/dochtml/internal/render/linkify.go
@@ -264,7 +264,7 @@
// formatLineHTML formats the line as HTML-annotated text.
// URLs and Go identifiers are linked to corresponding declarations.
-// If pre is true no conversion of `` or '' to “ and ” is performed.
+// If pre is true no conversion of doubled ` and ' to “ and ” is performed.
func (r *Renderer) formatLineHTML(line string, pre bool) safehtml.HTML {
var htmls []safehtml.HTML
var numQuotes int
@@ -694,7 +694,7 @@
var unicodeQuoteReplacer = strings.NewReplacer("``", ulquo, "''", urquo)
-// convertQuotes turns `` into “ and '' into ”.
+// convertQuotes turns doubled ` and ' into “ and ”.
func convertQuotes(text string) string {
return unicodeQuoteReplacer.Replace(text)
}
diff --git a/internal/godoc/dochtml/internal/render/render.go b/internal/godoc/dochtml/internal/render/render.go
index 0378b31..383a2ba 100644
--- a/internal/godoc/dochtml/internal/render/render.go
+++ b/internal/godoc/dochtml/internal/render/render.go
@@ -144,6 +144,7 @@
// into a hyperlink to the declaration of that identifier.
//
// This returns formatted HTML with:
+//
// <p> elements for plain documentation text
// <pre> elements for preformatted text
// <h3 id="hdr-XXX"> elements for headings with the "id" attribute
@@ -171,6 +172,7 @@
// This formats documentation HTML according to the same rules as DocHTML.
//
// This formats declaration HTML with:
+//
// <pre> element wrapping the entire declaration
// <span id="X" data-kind="K"> elements for many top-level declarations
// <span class="comment"> elements for every Go comment
@@ -191,6 +193,7 @@
// or assignment-compatible to ast.Expr, ast.Decl, ast.Spec, or ast.Stmt.
//
// This returns formatted HTML with:
+//
// <pre> element wrapping entire block
// <span class="comment"> elements for every Go comment
//
diff --git a/internal/godoc/internal/doc/comment.go b/internal/godoc/internal/doc/comment.go
index 75b3726..7537614 100644
--- a/internal/godoc/internal/doc/comment.go
+++ b/internal/godoc/internal/doc/comment.go
@@ -30,7 +30,7 @@
)
// Escape comment text for HTML. If nice is set,
-// also turn `` into “ and '' into ”.
+// also turn doubled ` and ' into “ and ”.
func commentEscape(w io.Writer, text string, nice bool) {
if nice {
// In the first pass, we convert `` and '' into their unicode equivalents.
@@ -94,8 +94,8 @@
// into a link). Go identifiers that appear in the words map are italicized; if
// the corresponding map value is not the empty string, it is considered a URL
// and the word is converted into a link. If nice is set, the remaining text's
-// appearance is improved where it makes sense (e.g., `` is turned into “
-// and '' into ”).
+// appearance is improved where it makes sense (e.g., doubled ` and ' is turned
+// into “ and ”).
func emphasize(w io.Writer, line string, words map[string]string, nice bool) {
for {
m := matchRx.FindStringSubmatchIndex(line)
diff --git a/internal/godoc/internal/doc/doc.go b/internal/godoc/internal/doc/doc.go
index 8f684ee..2c65768 100644
--- a/internal/godoc/internal/doc/doc.go
+++ b/internal/godoc/internal/doc/doc.go
@@ -114,7 +114,6 @@
// New takes ownership of the AST pkg and may edit or overwrite it.
// To have the Examples fields populated, use NewFromFiles and include
// the package's _test.go files.
-//
func New(pkg *ast.Package, importPath string, mode Mode) *Package {
var r reader
r.readPackage(pkg, mode)
@@ -156,7 +155,6 @@
//
// NewFromFiles takes ownership of the AST files and may edit them,
// unless the PreserveAST Mode bit is on.
-//
func NewFromFiles(fset *token.FileSet, files []*ast.File, importPath string, opts ...any) (*Package, error) {
// Check for invalid API usage.
if fset == nil {
diff --git a/internal/godoc/internal/doc/example.go b/internal/godoc/internal/doc/example.go
index 792ba56..713945f 100644
--- a/internal/godoc/internal/doc/example.go
+++ b/internal/godoc/internal/doc/example.go
@@ -457,13 +457,12 @@
//
// The classification process is ambiguous in some cases:
//
-// - ExampleFoo_Bar matches a type named Foo_Bar
-// or a method named Foo.Bar.
-// - ExampleFoo_bar matches a type named Foo_bar
-// or Foo (with a "bar" suffix).
+// - ExampleFoo_Bar matches a type named Foo_Bar
+// or a method named Foo.Bar.
+// - ExampleFoo_bar matches a type named Foo_bar
+// or Foo (with a "bar" suffix).
//
// Examples with malformed names are not associated with anything.
-//
func classifyExamples(p *Package, examples []*Example) {
if len(examples) == 0 {
return
diff --git a/internal/godoc/internal/doc/exports.go b/internal/godoc/internal/doc/exports.go
index 671c622..655e889 100644
--- a/internal/godoc/internal/doc/exports.go
+++ b/internal/godoc/internal/doc/exports.go
@@ -13,7 +13,6 @@
// filterIdentList removes unexported names from list in place
// and returns the resulting list.
-//
func filterIdentList(list []*ast.Ident) []*ast.Ident {
j := 0
for _, x := range list {
@@ -69,7 +68,6 @@
}
// hasExportedName reports whether list contains any exported names.
-//
func hasExportedName(list []*ast.Ident) bool {
for _, x := range list {
if x.IsExported() {
@@ -106,7 +104,6 @@
// in place and reports whether fields were removed. Anonymous fields are
// recorded with the parent type. filterType is called with the types of
// all remaining fields.
-//
func (r *reader) filterFieldList(parent *namedType, fields *ast.FieldList, ityp *ast.InterfaceType) (removedFields bool) {
if fields == nil {
return
@@ -159,7 +156,6 @@
}
// filterParamList applies filterType to each parameter type in fields.
-//
func (r *reader) filterParamList(fields *ast.FieldList) {
if fields != nil {
for _, f := range fields.List {
@@ -171,7 +167,6 @@
// filterType strips any unexported struct fields or method types from typ
// in place. If fields (or methods) have been removed, the corresponding
// struct or interface type has the Incomplete field set to true.
-//
func (r *reader) filterType(parent *namedType, typ ast.Expr) {
switch t := typ.(type) {
case *ast.Ident:
@@ -255,7 +250,6 @@
// copyConstType returns a copy of typ with position pos.
// typ must be a valid constant type.
// In practice, only (possibly qualified) identifiers are possible.
-//
func copyConstType(typ ast.Expr, pos token.Pos) ast.Expr {
switch typ := typ.(type) {
case *ast.Ident:
@@ -318,7 +312,6 @@
}
// fileExports removes unexported declarations from src in place.
-//
func (r *reader) fileExports(src *ast.File) {
j := 0
for _, d := range src.Decls {
diff --git a/internal/godoc/internal/doc/filter.go b/internal/godoc/internal/doc/filter.go
index 9904da1..f8d3e1f 100644
--- a/internal/godoc/internal/doc/filter.go
+++ b/internal/godoc/internal/doc/filter.go
@@ -97,7 +97,6 @@
// Filter eliminates documentation for names that don't pass through the filter f.
// TODO(gri): Recognize "Type.Method" as a name.
-//
func (p *Package) Filter(f Filter) {
p.Consts = filterValues(p.Consts, f)
p.Vars = filterValues(p.Vars, f)
diff --git a/internal/godoc/internal/doc/reader.go b/internal/godoc/internal/doc/reader.go
index 16b4c41..6a2cf10 100644
--- a/internal/godoc/internal/doc/reader.go
+++ b/internal/godoc/internal/doc/reader.go
@@ -22,12 +22,10 @@
// A methodSet describes a set of methods. Entries where Decl == nil are conflict
// entries (more than one method with the same name at the same embedding level).
-//
type methodSet map[string]*Func
// recvString returns a string representation of recv of the form "T", "*T",
// "T[A, ...]", "*T[A, ...]" or "BADRECV" (if not a proper receiver type).
-//
func recvString(recv ast.Expr) string {
switch t := recv.(type) {
case *ast.Ident:
@@ -66,7 +64,6 @@
// If there are multiple f's with the same name, set keeps the first
// one with documentation; conflicts are ignored. The boolean
// specifies whether to leave the AST untouched.
-//
func (mset methodSet) set(f *ast.FuncDecl, preserveAST bool) {
name := f.Name.Name
if g := mset[name]; g != nil && g.Doc != "" {
@@ -102,7 +99,6 @@
// add adds method m to the method set; m is ignored if the method set
// already contains a method with the same name at the same or a higher
// level than m.
-//
func (mset methodSet) add(m *Func) {
old := mset[m.Name]
if old == nil || m.Level < old.Level {
@@ -123,7 +119,6 @@
// baseTypeName returns the name of the base type of x (or "")
// and whether the type is imported or not.
-//
func baseTypeName(x ast.Expr) (name string, imported bool) {
switch t := x.(type) {
case *ast.Ident:
@@ -152,7 +147,6 @@
// A namedType represents a named unqualified (package local, or possibly
// predeclared) type. The namedType for a type name is always found via
// reader.lookupType.
-//
type namedType struct {
doc string // doc comment for type
name string // type name
@@ -177,7 +171,6 @@
// in the respective AST nodes so that they are not printed
// twice (once when printing the documentation and once when
// printing the corresponding AST node).
-//
type reader struct {
mode Mode
@@ -207,7 +200,6 @@
// If the base type has not been encountered yet, a new
// type with the given name but no associated declaration
// is added to the type map.
-//
func (r *reader) lookupType(name string) *namedType {
if name == "" || name == "_" {
return nil // no type docs for anonymous types
@@ -230,7 +222,6 @@
// anonymous field in the parent type. If the field is imported
// (qualified name) or the parent is nil, the field is ignored.
// The function returns the field name.
-//
func (r *reader) recordAnonymousField(parent *namedType, fieldType ast.Expr) (fname string) {
fname, imp := baseTypeName(fieldType)
if parent == nil || imp {
@@ -274,7 +265,6 @@
}
// readValue processes a const or var declaration.
-//
func (r *reader) readValue(decl *ast.GenDecl) {
// determine if decl should be associated with a type
// Heuristic: For each typed entry, determine the type name, if any.
@@ -348,7 +338,6 @@
}
// fields returns a struct's fields or an interface's methods.
-//
func fields(typ ast.Expr) (list []*ast.Field, isStruct bool) {
var fields *ast.FieldList
switch t := typ.(type) {
@@ -365,7 +354,6 @@
}
// readType processes a type declaration.
-//
func (r *reader) readType(decl *ast.GenDecl, spec *ast.TypeSpec) {
typ := r.lookupType(spec.Name.Name)
if typ == nil {
@@ -401,13 +389,11 @@
}
// isPredeclared reports whether n denotes a predeclared type.
-//
func (r *reader) isPredeclared(n string) bool {
return predeclaredTypes[n] && r.types[n] == nil
}
// readFunc processes a func or method declaration.
-//
func (r *reader) readFunc(fun *ast.FuncDecl) {
// strip function body if requested.
if r.mode&PreserveAST == 0 {
@@ -501,7 +487,6 @@
)
// readNote collects a single note from a sequence of comments.
-//
func (r *reader) readNote(list []*ast.Comment) {
text := (&ast.CommentGroup{List: list}).Text()
if m := noteMarkerRx.FindStringSubmatchIndex(text); m != nil {
@@ -527,7 +512,6 @@
// and is followed by the note body (e.g., "// BUG(gri): fix this").
// The note ends at the end of the comment group or at the start of
// another note in the same comment group, whichever comes first.
-//
func (r *reader) readNotes(comments []*ast.CommentGroup) {
for _, group := range comments {
i := -1 // comment index of most recent note start, valid if >= 0
@@ -547,7 +531,6 @@
}
// readFile adds the AST for a source file to the reader.
-//
func (r *reader) readFile(src *ast.File) {
// add package documentation
if src.Doc != nil {
@@ -697,7 +680,6 @@
}
// collectEmbeddedMethods collects the embedded methods of typ in mset.
-//
func (r *reader) collectEmbeddedMethods(mset methodSet, typ *namedType, recvTypeName string, embeddedIsPtr bool, level int, visited embeddedSet) {
visited[typ] = true
for embedded, isPtr := range typ.embedded {
@@ -721,7 +703,6 @@
}
// computeMethodSets determines the actual method sets for each type encountered.
-//
func (r *reader) computeMethodSets() {
for _, t := range r.types {
// collect embedded methods for t
@@ -747,7 +728,6 @@
// types that have no declaration. Instead, these functions and methods
// are shown at the package level. It also removes types with missing
// declarations or which are not visible.
-//
func (r *reader) cleanupTypes() {
for _, t := range r.types {
visible := r.isVisible(t.name)
@@ -814,7 +794,6 @@
}
// sortingName returns the name to use when sorting d into place.
-//
func sortingName(d *ast.GenDecl) string {
if len(d.Specs) == 1 {
if s, ok := d.Specs[0].(*ast.ValueSpec); ok {
@@ -907,7 +886,6 @@
// noteBodies returns a list of note body strings given a list of notes.
// This is only used to populate the deprecated Package.Bugs field.
-//
func noteBodies(notes []*Note) []string {
var list []string
for _, n := range notes {
diff --git a/internal/godoc/internal/doc/synopsis.go b/internal/godoc/internal/doc/synopsis.go
index 3fa1616..ca607cc 100644
--- a/internal/godoc/internal/doc/synopsis.go
+++ b/internal/godoc/internal/doc/synopsis.go
@@ -12,7 +12,6 @@
// firstSentenceLen returns the length of the first sentence in s.
// The sentence ends after the first period followed by space and
// not preceded by exactly one uppercase letter.
-//
func firstSentenceLen(s string) int {
var ppp, pp, p rune
for i, q := range s {
@@ -64,7 +63,6 @@
// has no \n, \r, or \t characters and uses only single spaces between
// words. If s starts with any of the IllegalPrefixes, the result
// is the empty string.
-//
func Synopsis(s string) string {
s = clean(s[0:firstSentenceLen(s)], 0)
for _, prefix := range IllegalPrefixes {
diff --git a/internal/licenses/licenses.go b/internal/licenses/licenses.go
index f8ac464..d19a726 100644
--- a/internal/licenses/licenses.go
+++ b/internal/licenses/licenses.go
@@ -8,14 +8,16 @@
// redistributable.
//
// Example (modproxy):
-// d := licenses.NewDetector(modulePath, version, zipReader, log.Infof)
-// modRedist := d.ModuleIsRedistributable()
+//
+// d := licenses.NewDetector(modulePath, version, zipReader, log.Infof)
+// modRedist := d.ModuleIsRedistributable()
//
// Example (discovery):
-// d := licenses.NewDetector(modulePath, version, zipReader, log.Infof)
-// modRedist := d.ModuleIsRedistributable()
-// lics := d.AllLicenses()
-// pkgRedist, pkgMetas := d.PackageInfo(pkgSubdir)
+//
+// d := licenses.NewDetector(modulePath, version, zipReader, log.Infof)
+// modRedist := d.ModuleIsRedistributable()
+// lics := d.AllLicenses()
+// pkgRedist, pkgMetas := d.PackageInfo(pkgSubdir)
package licenses
import (
@@ -468,9 +470,9 @@
// isVendoredFile reports if the given file is in a proper subdirectory nested
// under a 'vendor' directory, to allow for Go packages named 'vendor'.
-//
-// e.g. isVendoredFile("vendor/LICENSE") == false, and
-// isVendoredFile("vendor/foo/LICENSE") == true
+// For example:
+// - isVendoredFile("vendor/LICENSE") == false, and
+// - isVendoredFile("vendor/foo/LICENSE") == true.
func isVendoredFile(name string) bool {
var vendorOffset int
if strings.HasPrefix(name, "vendor/") {
diff --git a/internal/middleware/stats.go b/internal/middleware/stats.go
index 8e1f2d2..c333d9d 100644
--- a/internal/middleware/stats.go
+++ b/internal/middleware/stats.go
@@ -49,7 +49,9 @@
// ElapsedStat records as a stat the elapsed time for a
// function execution. Invoke like so:
-// defer ElapsedStat(ctx, "FunctionName")()
+//
+// defer ElapsedStat(ctx, "FunctionName")()
+//
// The resulting stat will be called "FunctionName ms" and will
// be the wall-clock execution time of the function in milliseconds.
func ElapsedStat(ctx context.Context, name string) func() {
diff --git a/internal/postgres/search.go b/internal/postgres/search.go
index 1c47204..3c71605 100644
--- a/internal/postgres/search.go
+++ b/internal/postgres/search.go
@@ -249,13 +249,14 @@
// scoreExpr is the expression that computes the search score.
// It is the product of:
-// - The Postgres ts_rank score, based the relevance of the document to the query.
-// - The log of the module's popularity, estimated by the number of importing packages.
-// The log factor contains exp(1) so that it is always >= 1. Taking the log
-// of imported_by_count instead of using it directly makes the effect less
-// dramatic: being 2x as popular only has an additive effect.
-// - A penalty factor for non-redistributable modules, since a lot of
-// details cannot be displayed.
+// - The Postgres ts_rank score, based the relevance of the document to the query.
+// - The log of the module's popularity, estimated by the number of importing packages.
+// The log factor contains exp(1) so that it is always >= 1. Taking the log
+// of imported_by_count instead of using it directly makes the effect less
+// dramatic: being 2x as popular only has an additive effect.
+// - A penalty factor for non-redistributable modules, since a lot of
+// details cannot be displayed.
+//
// The first argument to ts_rank is an array of weights for the four tsvector sections,
// in the order D, C, B, A.
// The weights below match the defaults except for B.
diff --git a/internal/postgres/searchdoc.go b/internal/postgres/searchdoc.go
index 5abbe69..b78fffa 100644
--- a/internal/postgres/searchdoc.go
+++ b/internal/postgres/searchdoc.go
@@ -120,9 +120,10 @@
// summaryReplacements is used to replace words with other words.
// It is used by processWord, below.
// Example key-value pairs:
-// "deleteMe": nil // removes "deleteMe"
-// "rand": []string{"random"} // replace "rand" with "random"
-// "utf-8": []string{"utf-8", "utf8"} // add "utf8" whenever "utf-8" is seen
+//
+// "deleteMe": nil // removes "deleteMe"
+// "rand": []string{"random"} // replace "rand" with "random"
+// "utf-8": []string{"utf-8", "utf8"} // add "utf8" whenever "utf-8" is seen
var summaryReplacements = map[string][]string{
"postgres": {"postgres", "postgresql"},
"postgresql": {"postgres", "postgresql"},
diff --git a/internal/postgres/test_helper.go b/internal/postgres/test_helper.go
index 23366f1..1f990a0 100644
--- a/internal/postgres/test_helper.go
+++ b/internal/postgres/test_helper.go
@@ -101,9 +101,10 @@
// return value of the function should be called in a defer statement to release the database.
// For example:
//
-// func Test(t *testing.T) {
-// db, release := acquire(t)
-// defer release()
+// func Test(t *testing.T) {
+// db, release := acquire(t)
+// defer release()
+// }
func RunDBTestsInParallel(dbBaseName string, numDBs int, m *testing.M, acquirep *func(*testing.T) (*DB, func())) {
start := time.Now()
database.QueryLoggingDisabled = true
diff --git a/internal/postgres/unit.go b/internal/postgres/unit.go
index 200d595..234990c 100644
--- a/internal/postgres/unit.go
+++ b/internal/postgres/unit.go
@@ -26,14 +26,17 @@
// If the module is unknown, pass internal.UnknownModulePath; if the version is unknown, pass
// internal.LatestVersion.
//
-// The rules for picking the best are:
+// The rules for picking the best are as follows.
+//
// 1. If the version is known but the module path is not, choose the longest module path
-// at that version that contains fullPath.
+// at that version that contains fullPath.
+//
// 2. Otherwise, find the latest "good" version (in the modules table) that contains fullPath.
-// a. First, follow the algorithm of the go command: prefer longer module paths, and
-// find the latest unretracted version, using semver but preferring release to pre-release.
-// b. If no modules have latest-version information, find the latest by sorting the versions
-// we do have: again first by module path length, then by version.
+//
+// a. First, follow the algorithm of the go command: prefer longer module paths, and
+// find the latest unretracted version, using semver but preferring release to pre-release.
+// b. If no modules have latest-version information, find the latest by sorting the versions
+// we do have: again first by module path length, then by version.
func (db *DB) GetUnitMeta(ctx context.Context, fullPath, requestedModulePath, requestedVersion string) (_ *internal.UnitMeta, err error) {
defer derrors.WrapStack(&err, "DB.GetUnitMeta(ctx, %q, %q, %q)", fullPath, requestedModulePath, requestedVersion)
defer middleware.ElapsedStat(ctx, "DB.GetUnitMeta")()
diff --git a/internal/source/source.go b/internal/source/source.go
index 499a80c..86430f2 100644
--- a/internal/source/source.go
+++ b/internal/source/source.go
@@ -410,10 +410,14 @@
// moduleOrRepoPath. It is not when the argument is a module path that uses the
// go command's general syntax, which ends in a ".vcs" (e.g. ".git", ".hg") that
// is neither part of the repo nor the suffix. For example, if the argument is
-// github.com/a/b/c
+//
+// github.com/a/b/c
+//
// then repo="github.com/a/b" and relativeModulePath="c"; together they make up the module path.
// But if the argument is
-// example.com/a/b.git/c
+//
+// example.com/a/b.git/c
+//
// then repo="example.com/a/b" and relativeModulePath="c"; the ".git" is omitted, since it is neither
// part of the repo nor part of the relative path to the module within the repo.
func matchStatic(moduleOrRepoPath string) (repo, relativeModulePath string, _ urlTemplates, transformCommit transformCommitFunc, _ error) {
@@ -783,14 +787,13 @@
//
// The template variables are:
//
-// • {repo} - Repository URL with "https://" prefix ("https://example.com/myrepo").
-// • {importPath} - Package import path ("example.com/myrepo/mypkg").
-// • {commit} - Tag name or commit hash corresponding to version ("v0.1.0" or "1234567890ab").
-// • {dir} - Path to directory of the package, relative to repo root ("mypkg").
-// • {file} - Path to file containing the identifier, relative to repo root ("mypkg/file.go").
-// • {base} - Base name of file containing the identifier, including file extension ("file.go").
-// • {line} - Line number for the identifier ("41").
-//
+// - {repo} - Repository URL with "https://" prefix ("https://example.com/myrepo").
+// - {importPath} - Package import path ("example.com/myrepo/mypkg").
+// - {commit} - Tag name or commit hash corresponding to version ("v0.1.0" or "1234567890ab").
+// - {dir} - Path to directory of the package, relative to repo root ("mypkg").
+// - {file} - Path to file containing the identifier, relative to repo root ("mypkg/file.go").
+// - {base} - Base name of file containing the identifier, including file extension ("file.go").
+// - {line} - Line number for the identifier ("41").
type urlTemplates struct {
Repo string `json:",omitempty"` // Optional URL template for the repository home page, with {repo}. If left empty, a default template "{repo}" is used.
Directory string // URL template for a directory, with {repo}, {importPath}, {commit}, {dir}.
diff --git a/internal/stdlib/stdlib.go b/internal/stdlib/stdlib.go
index 654773a..cf0d155 100644
--- a/internal/stdlib/stdlib.go
+++ b/internal/stdlib/stdlib.go
@@ -63,12 +63,13 @@
// tag doesn't correspond to a Go release or beta tag. In special cases,
// when the tag specified is either `latest` or `master` it will return the tag.
// Examples:
-// "go1" => "v1.0.0"
-// "go1.2" => "v1.2.0"
-// "go1.13beta1" => "v1.13.0-beta.1"
-// "go1.9rc2" => "v1.9.0-rc.2"
-// "latest" => "latest"
-// "master" => "master"
+//
+// "go1" => "v1.0.0"
+// "go1.2" => "v1.2.0"
+// "go1.13beta1" => "v1.13.0-beta.1"
+// "go1.9rc2" => "v1.9.0-rc.2"
+// "latest" => "latest"
+// "master" => "master"
func VersionForTag(tag string) string {
// Special cases for go1.
if tag == "go1" {
@@ -212,7 +213,8 @@
// WithTestData arranges for this package to use a testing version of the Go repo.
// The returned function restores the previous state. Use with defer:
-// defer WithTestData()()
+//
+// defer WithTestData()()
func WithTestData() func() {
return withGoRepo(&testGoRepo{})
}
diff --git a/internal/symbol/generate.go b/internal/symbol/generate.go
index 0bdaefd..3fd4e0d 100644
--- a/internal/symbol/generate.go
+++ b/internal/symbol/generate.go
@@ -162,7 +162,6 @@
// except we accept pkgPath as an argument to check that pkg.ImportPath ==
// pkgPath and retry on various go list errors.
//
-//
// loadImports populates w with information about the packages in the standard
// library and the packages they themselves import in w's build context.
//
diff --git a/internal/testing/sample/sample.go b/internal/testing/sample/sample.go
index c2fcf9d..1576ab1 100644
--- a/internal/testing/sample/sample.go
+++ b/internal/testing/sample/sample.go
@@ -158,7 +158,8 @@
//
// This makes it easier to work with timestamps in PostgreSQL, which have
// Microsecond precision:
-// https://www.postgresql.org/docs/9.1/datatype-datetime.html
+//
+// https://www.postgresql.org/docs/9.1/datatype-datetime.html
func NowTruncated() time.Time {
return time.Now().In(time.UTC).Truncate(time.Microsecond)
}
diff --git a/internal/version/version.go b/internal/version/version.go
index aed54c3..0d4a955 100644
--- a/internal/version/version.go
+++ b/internal/version/version.go
@@ -143,7 +143,9 @@
// appendNumericPrefix appends a string representing n to dst.
// n is the length of a digit string; the value we append is a prefix for the
// digit string s such that
-// prefix1 + s1 < prefix2 + s2
+//
+// prefix1 + s1 < prefix2 + s2
+//
// if and only if the integer denoted by s1 is less than the one denoted by s2.
// In other words, prefix + s is a string that can be compared with other such
// strings while preserving the ordering of the numbers.
@@ -151,13 +153,15 @@
// If n==1, there is no prefix. (Single-digit numbers are unchanged.)
// Otherwise, the prefix is a sequence of lower-case letters encoding n.
// Examples:
-// n prefix
-// 1 <none>
-// 2 a
-// 27 z
-// 28 za
-// 53 zz
-// 54 zza
+//
+// n prefix
+// 1 <none>
+// 2 a
+// 27 z
+// 28 za
+// 53 zz
+// 54 zza
+//
// This encoding depends on the ASCII properties that:
// - digits are ordered numerically
// - letters are ordered alphabetically
diff --git a/internal/worker/server.go b/internal/worker/server.go
index a7ef858..e6b07ad 100644
--- a/internal/worker/server.go
+++ b/internal/worker/server.go
@@ -370,6 +370,7 @@
// is assumed to have either of the following two structures:
// - <module>/@v/<version>
// - <module>/@latest
+//
// (this is symmetric with the proxy url scheme)
func parseModulePathAndVersion(requestPath string) (string, string, error) {
p := strings.TrimPrefix(requestPath, "/")
To view, visit change 399617. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ib37025f3feda6c1ac63a48247a644dd5afac2be8
Reviewed-on: https://go-review.googlesource.com/c/term/+/399619
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M term.go
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/term.go b/term.go
index d592708..1a40d10 100644
--- a/term.go
+++ b/term.go
@@ -7,11 +7,11 @@
//
// Putting a terminal into raw mode is the most common requirement:
//
-// oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
-// if err != nil {
-// panic(err)
-// }
-// defer term.Restore(int(os.Stdin.Fd()), oldState)
+// oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
+// if err != nil {
+// panic(err)
+// }
+// defer term.Restore(int(os.Stdin.Fd()), oldState)
//
// Note that on non-Unix systems os.Stdin.Fd() may not be 0.
package term
To view, visit change 399619. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Id333e34e0c5cd0bea79dcf5dd51130639597b2ee
Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/399616
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M endpoints/endpoints.go
M google/default.go
M google/doc.go
3 files changed, 39 insertions(+), 22 deletions(-)
diff --git a/endpoints/endpoints.go b/endpoints/endpoints.go
index cd3e167..7cc37c8 100644
--- a/endpoints/endpoints.go
+++ b/endpoints/endpoints.go
@@ -19,7 +19,7 @@
// Battlenet is the endpoint for Battlenet.
var Battlenet = oauth2.Endpoint{
- AuthURL: "https://battle.net/oauth/authorize",
+ AuthURL: "https://battle.net/oauth/authorize",
TokenURL: "https://battle.net/oauth/token",
}
diff --git a/google/default.go b/google/default.go
index 880dd7b..dd00420 100644
--- a/google/default.go
+++ b/google/default.go
@@ -94,20 +94,20 @@
// It looks for credentials in the following places,
// preferring the first location found:
//
-// 1. A JSON file whose path is specified by the
-// GOOGLE_APPLICATION_CREDENTIALS environment variable.
-// For workload identity federation, refer to
-// https://cloud.google.com/iam/docs/how-to#using-workload-identity-federation on
-// how to generate the JSON configuration file for on-prem/non-Google cloud
-// platforms.
-// 2. A JSON file in a location known to the gcloud command-line tool.
-// On Windows, this is %APPDATA%/gcloud/application_default_credentials.json.
-// On other systems, $HOME/.config/gcloud/application_default_credentials.json.
-// 3. On Google App Engine standard first generation runtimes (<= Go 1.9) it uses
-// the appengine.AccessToken function.
-// 4. On Google Compute Engine, Google App Engine standard second generation runtimes
-// (>= Go 1.11), and Google App Engine flexible environment, it fetches
-// credentials from the metadata server.
+// 1. A JSON file whose path is specified by the
+// GOOGLE_APPLICATION_CREDENTIALS environment variable.
+// For workload identity federation, refer to
+// https://cloud.google.com/iam/docs/how-to#using-workload-identity-federation on
+// how to generate the JSON configuration file for on-prem/non-Google cloud
+// platforms.
+// 2. A JSON file in a location known to the gcloud command-line tool.
+// On Windows, this is %APPDATA%/gcloud/application_default_credentials.json.
+// On other systems, $HOME/.config/gcloud/application_default_credentials.json.
+// 3. On Google App Engine standard first generation runtimes (<= Go 1.9) it uses
+// the appengine.AccessToken function.
+// 4. On Google Compute Engine, Google App Engine standard second generation runtimes
+// (>= Go 1.11), and Google App Engine flexible environment, it fetches
+// credentials from the metadata server.
func FindDefaultCredentialsWithParams(ctx context.Context, params CredentialsParams) (*Credentials, error) {
// Make defensive copy of the slices in params.
params = params.deepCopy()
diff --git a/google/doc.go b/google/doc.go
index 8e6a57c..dddf651 100644
--- a/google/doc.go
+++ b/google/doc.go
@@ -15,14 +15,14 @@
// For more information on using workload identity federation, refer to
// https://cloud.google.com/iam/docs/how-to#using-workload-identity-federation.
//
-// OAuth2 Configs
+// # OAuth2 Configs
//
// Two functions in this package return golang.org/x/oauth2.Config values from Google credential
// data. Google supports two JSON formats for OAuth2 credentials: one is handled by ConfigFromJSON,
// the other by JWTConfigFromJSON. The returned Config can be used to obtain a TokenSource or
// create an http.Client.
//
-// Workload Identity Federation
+// # Workload Identity Federation
//
// Using workload identity federation, your application can access Google Cloud
// resources from Amazon Web Services (AWS), Microsoft Azure or any identity
@@ -36,9 +36,9 @@
// Follow the detailed instructions on how to configure Workload Identity Federation
// in various platforms:
//
-// Amazon Web Services (AWS): https://cloud.google.com/iam/docs/access-resources-aws
-// Microsoft Azure: https://cloud.google.com/iam/docs/access-resources-azure
-// OIDC identity provider: https://cloud.google.com/iam/docs/access-resources-oidc
+// Amazon Web Services (AWS): https://cloud.google.com/iam/docs/access-resources-aws
+// Microsoft Azure: https://cloud.google.com/iam/docs/access-resources-azure
+// OIDC identity provider: https://cloud.google.com/iam/docs/access-resources-oidc
//
// For OIDC providers, the library can retrieve OIDC tokens either from a
// local file location (file-sourced credentials) or from a local server
@@ -51,8 +51,7 @@
// return the OIDC token. The response can be in plain text or JSON.
// Additional required request headers can also be specified.
//
-//
-// Credentials
+// # Credentials
//
// The Credentials type represents Google credentials, including Application Default
// Credentials.
To view, visit change 399616. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: I2d123f7bafdf8043fffd6bb70858ee4d15d7c07c
Reviewed-on: https://go-review.googlesource.com/c/mod/+/399598
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M gosumcheck/main.go
M modfile/read.go
M module/module.go
M sumdb/note/note.go
M sumdb/server.go
M sumdb/tlog/tlog.go
M zip/zip.go
7 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/gosumcheck/main.go b/gosumcheck/main.go
index 1e92f1f..c1d8fc2 100644
--- a/gosumcheck/main.go
+++ b/gosumcheck/main.go
@@ -28,7 +28,6 @@
//
// To discourage misuse in automated settings, gosumcheck does not
// set any exit status to report whether any problems were found.
-//
package main
import (
diff --git a/modfile/read.go b/modfile/read.go
index 956f30c..70947ee 100644
--- a/modfile/read.go
+++ b/modfile/read.go
@@ -285,7 +285,6 @@
// "x"
// "y"
// )
-//
type LineBlock struct {
Comments
Start Position
diff --git a/module/module.go b/module/module.go
index 355b5a4..795d076 100644
--- a/module/module.go
+++ b/module/module.go
@@ -15,7 +15,7 @@
// but additional checking functions, most notably Check, verify that
// a particular path, version pair is valid.
//
-// Escaped Paths
+// # Escaped Paths
//
// Module paths appear as substrings of file system paths
// (in the download cache) and of web server URLs in the proxy protocol.
@@ -55,7 +55,7 @@
// Import paths have never allowed exclamation marks, so there is no
// need to define how to escape a literal !.
//
-// Unicode Restrictions
+// # Unicode Restrictions
//
// Today, paths are disallowed from using Unicode.
//
diff --git a/sumdb/note/note.go b/sumdb/note/note.go
index 4a00501..4d86eef 100644
--- a/sumdb/note/note.go
+++ b/sumdb/note/note.go
@@ -18,7 +18,7 @@
// A given server may have multiple public keys, each
// identified by a 32-bit hash of the public key.
//
-// Verifying Notes
+// # Verifying Notes
//
// A Verifier allows verification of signatures by one server public key.
// It can report the name of the server and the uint32 hash of the key,
@@ -45,7 +45,7 @@
// the message signatures and returns a Note structure
// containing the message text and (verified or unverified) signatures.
//
-// Signing Notes
+// # Signing Notes
//
// A Signer allows signing a text with a given key.
// It can report the name of the server and the hash of the key
@@ -61,7 +61,7 @@
// The Sign function takes as input a Note and a list of Signers
// and returns an encoded, signed message.
//
-// Signed Note Format
+// # Signed Note Format
//
// A signed note consists of a text ending in newline (U+000A),
// followed by a blank line (only a newline),
@@ -81,7 +81,7 @@
// to sign the note text (including the final newline but not the
// separating blank line).
//
-// Generating Keys
+// # Generating Keys
//
// There is only one key type, Ed25519 with algorithm identifier 1.
// New key types may be introduced in the future as needed,
@@ -91,7 +91,7 @@
// The GenerateKey function generates and returns a new signer
// and corresponding verifier.
//
-// Example
+// # Example
//
// Here is a well-formed signed note:
//
@@ -171,7 +171,6 @@
//
// — PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=
// — EnochRoot rwz+eBzmZa0SO3NbfRGzPCpDckykFXSdeX+MNtCOXm2/5n2tiOHp+vAF1aGrQ5ovTG01oOTGwnWLox33WWd1RvMc+QQ=
-//
package note
import (
diff --git a/sumdb/server.go b/sumdb/server.go
index 28866f1..2e523a5 100644
--- a/sumdb/server.go
+++ b/sumdb/server.go
@@ -54,7 +54,6 @@
// for _, path := range sumdb.ServerPaths {
// http.Handle(path, srv)
// }
-//
var ServerPaths = []string{
"/lookup/",
"/latest",
diff --git a/sumdb/tlog/tlog.go b/sumdb/tlog/tlog.go
index 01d06c4..ae065f8 100644
--- a/sumdb/tlog/tlog.go
+++ b/sumdb/tlog/tlog.go
@@ -8,7 +8,6 @@
// This package follows the design of Certificate Transparency (RFC 6962)
// and its proofs are compatible with that system.
// See TestCertificateTransparency.
-//
package tlog
import (
diff --git a/zip/zip.go b/zip/zip.go
index ca0f7ad..949cae2 100644
--- a/zip/zip.go
+++ b/zip/zip.go
@@ -931,7 +931,9 @@
}
// strToFold returns a string with the property that
+//
// strings.EqualFold(s, t) iff strToFold(s) == strToFold(t)
+//
// This lets us test a large set of strings for fold-equivalent
// duplicates without making a quadratic number of calls
// to EqualFold. Note that strings.ToUpper and strings.ToLower
To view, visit change 399598. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: I076031b6613691eefbb0f21739366e3fd2011ec9
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/399356
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M acme/acme.go
M acme/autocert/listener.go
M acme/internal/acmeprobe/prober.go
M argon2/argon2.go
M chacha20/chacha_s390x.go
M cryptobyte/builder.go
M curve25519/internal/field/fe_alias_test.go
M curve25519/internal/field/fe_amd64.go
M internal/poly1305/sum_generic.go
M internal/poly1305/sum_s390x.go
M openpgp/armor/armor.go
M openpgp/armor/encode.go
M openpgp/elgamal/elgamal.go
M openpgp/packet/signature_v3_test.go
M pbkdf2/pbkdf2.go
M scrypt/scrypt.go
M sha3/doc.go
M sha3/sha3_s390x.go
M ssh/agent/client.go
M ssh/certs_test.go
M ssh/cipher.go
M ssh/doc.go
22 files changed, 100 insertions(+), 70 deletions(-)
diff --git a/acme/acme.go b/acme/acme.go
index f2d23f6..2c86df3 100644
--- a/acme/acme.go
+++ b/acme/acme.go
@@ -77,12 +77,11 @@
// The only required field is Key. An example of creating a client with a new key
// is as follows:
//
-// key, err := rsa.GenerateKey(rand.Reader, 2048)
-// if err != nil {
-// log.Fatal(err)
-// }
-// client := &Client{Key: key}
-//
+// key, err := rsa.GenerateKey(rand.Reader, 2048)
+// if err != nil {
+// log.Fatal(err)
+// }
+// client := &Client{Key: key}
type Client struct {
// Key is the account key used to register with a CA and sign requests.
// Key.Public() must return a *rsa.PublicKey or *ecdsa.PublicKey.
diff --git a/acme/autocert/listener.go b/acme/autocert/listener.go
index cb48609..9d62f8c 100644
--- a/acme/autocert/listener.go
+++ b/acme/autocert/listener.go
@@ -20,7 +20,7 @@
//
// It enables one-line HTTPS servers:
//
-// log.Fatal(http.Serve(autocert.NewListener("example.com"), handler))
+// log.Fatal(http.Serve(autocert.NewListener("example.com"), handler))
//
// NewListener is a convenience function for a common configuration.
// More complex or custom configurations can use the autocert.Manager
diff --git a/acme/internal/acmeprobe/prober.go b/acme/internal/acmeprobe/prober.go
index 471707d..25dba0c 100644
--- a/acme/internal/acmeprobe/prober.go
+++ b/acme/internal/acmeprobe/prober.go
@@ -11,12 +11,12 @@
//
// A usage example:
//
-// go run prober.go \
-// -d https://acme-staging-v02.api.letsencrypt.org/directory \
-// -f order \
-// -t http-01 \
-// -a :8080 \
-// -domain some.example.org
+// go run prober.go \
+// -d https://acme-staging-v02.api.letsencrypt.org/directory \
+// -f order \
+// -t http-01 \
+// -a :8080 \
+// -domain some.example.org
//
// The above assumes a TCP tunnel from some.example.org:80 to 0.0.0.0:8080
// in order for the test to be able to fulfill http-01 challenge.
diff --git a/argon2/argon2.go b/argon2/argon2.go
index b423fea..29f0a2d 100644
--- a/argon2/argon2.go
+++ b/argon2/argon2.go
@@ -11,8 +11,7 @@
// If you aren't sure which function you need, use Argon2id (IDKey) and
// the parameter recommendations for your scenario.
//
-//
-// Argon2i
+// # Argon2i
//
// Argon2i (implemented by Key) is the side-channel resistant version of Argon2.
// It uses data-independent memory access, which is preferred for password
@@ -21,8 +20,7 @@
// parameters (taken from [2]) for non-interactive operations are time=3 and to
// use the maximum available memory.
//
-//
-// Argon2id
+// # Argon2id
//
// Argon2id (implemented by IDKey) is a hybrid version of Argon2 combining
// Argon2i and Argon2d. It uses data-independent memory access for the first
@@ -59,7 +57,7 @@
// For example, you can get a derived key for e.g. AES-256 (which needs a
// 32-byte key) by doing:
//
-// key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32)
+// key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32)
//
// The draft RFC recommends[2] time=3, and memory=32*1024 is a sensible number.
// If using that amount of memory (32 MB) is not possible in some contexts then
@@ -83,7 +81,7 @@
// For example, you can get a derived key for e.g. AES-256 (which needs a
// 32-byte key) by doing:
//
-// key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32)
+// key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32)
//
// The draft RFC recommends[2] time=1, and memory=64*1024 is a sensible number.
// If using that amount of memory (64 MB) is not possible in some contexts then
diff --git a/chacha20/chacha_s390x.go b/chacha20/chacha_s390x.go
index c5898db..4652247 100644
--- a/chacha20/chacha_s390x.go
+++ b/chacha20/chacha_s390x.go
@@ -15,6 +15,7 @@
// xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only
// be called when the vector facility is available. Implementation in asm_s390x.s.
+//
//go:noescape
func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
diff --git a/cryptobyte/builder.go b/cryptobyte/builder.go
index ca7b1db..c7ded75 100644
--- a/cryptobyte/builder.go
+++ b/cryptobyte/builder.go
@@ -106,13 +106,13 @@
// supplied to them. The child builder passed to the continuation can be used
// to build the content of the length-prefixed sequence. For example:
//
-// parent := cryptobyte.NewBuilder()
-// parent.AddUint8LengthPrefixed(func (child *Builder) {
-// child.AddUint8(42)
-// child.AddUint8LengthPrefixed(func (grandchild *Builder) {
-// grandchild.AddUint8(5)
-// })
-// })
+// parent := cryptobyte.NewBuilder()
+// parent.AddUint8LengthPrefixed(func (child *Builder) {
+// child.AddUint8(42)
+// child.AddUint8LengthPrefixed(func (grandchild *Builder) {
+// grandchild.AddUint8(5)
+// })
+// })
//
// It is an error to write more bytes to the child than allowed by the reserved
// length prefix. After the continuation returns, the child must be considered
diff --git a/curve25519/internal/field/fe_alias_test.go b/curve25519/internal/field/fe_alias_test.go
index 5ad81df..64e57c4 100644
--- a/curve25519/internal/field/fe_alias_test.go
+++ b/curve25519/internal/field/fe_alias_test.go
@@ -77,11 +77,11 @@
// TestAliasing checks that receivers and arguments can alias each other without
// leading to incorrect results. That is, it ensures that it's safe to write
//
-// v.Invert(v)
+// v.Invert(v)
//
// or
//
-// v.Add(v, v)
+// v.Add(v, v)
//
// without any of the inputs getting clobbered by the output being written.
func TestAliasing(t *testing.T) {
diff --git a/curve25519/internal/field/fe_amd64.go b/curve25519/internal/field/fe_amd64.go
index 44dc8e8..edcf163 100644
--- a/curve25519/internal/field/fe_amd64.go
+++ b/curve25519/internal/field/fe_amd64.go
@@ -1,13 +1,16 @@
// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT.
+//go:build amd64 && gc && !purego
// +build amd64,gc,!purego
package field
// feMul sets out = a * b. It works like feMulGeneric.
+//
//go:noescape
func feMul(out *Element, a *Element, b *Element)
// feSquare sets out = a * a. It works like feSquareGeneric.
+//
//go:noescape
func feSquare(out *Element, a *Element)
diff --git a/internal/poly1305/sum_generic.go b/internal/poly1305/sum_generic.go
index c942a65..e041da5 100644
--- a/internal/poly1305/sum_generic.go
+++ b/internal/poly1305/sum_generic.go
@@ -136,7 +136,7 @@
// updateGeneric absorbs msg into the state.h accumulator. For each chunk m of
// 128 bits of message, it computes
//
-// h₊ = (h + m) * r mod 2¹³⁰ - 5
+// h₊ = (h + m) * r mod 2¹³⁰ - 5
//
// If the msg length is not a multiple of TagSize, it assumes the last
// incomplete chunk is the final one.
@@ -278,8 +278,7 @@
// finalize completes the modular reduction of h and computes
//
-// out = h + s mod 2¹²⁸
-//
+// out = h + s mod 2¹²⁸
func finalize(out *[TagSize]byte, h *[3]uint64, s *[2]uint64) {
h0, h1, h2 := h[0], h[1], h[2]
diff --git a/internal/poly1305/sum_s390x.go b/internal/poly1305/sum_s390x.go
index 62cc9f8..ec95966 100644
--- a/internal/poly1305/sum_s390x.go
+++ b/internal/poly1305/sum_s390x.go
@@ -14,6 +14,7 @@
// updateVX is an assembly implementation of Poly1305 that uses vector
// instructions. It must only be called if the vector facility (vx) is
// available.
+//
//go:noescape
func updateVX(state *macState, msg []byte)
diff --git a/openpgp/armor/armor.go b/openpgp/armor/armor.go
index ebc8787..be342ad 100644
--- a/openpgp/armor/armor.go
+++ b/openpgp/armor/armor.go
@@ -23,12 +23,14 @@
// A Block represents an OpenPGP armored structure.
//
// The encoded form is:
-// -----BEGIN Type-----
-// Headers
//
-// base64-encoded Bytes
-// '=' base64 encoded checksum
-// -----END Type-----
+// -----BEGIN Type-----
+// Headers
+//
+// base64-encoded Bytes
+// '=' base64 encoded checksum
+// -----END Type-----
+//
// where Headers is a possibly empty sequence of Key: Value lines.
//
// Since the armored data can be very large, this package presents a streaming
diff --git a/openpgp/armor/encode.go b/openpgp/armor/encode.go
index 6f07582..5b6e16c 100644
--- a/openpgp/armor/encode.go
+++ b/openpgp/armor/encode.go
@@ -96,7 +96,8 @@
// trailer.
//
// It's built into a stack of io.Writers:
-// encoding -> base64 encoder -> lineBreaker -> out
+//
+// encoding -> base64 encoder -> lineBreaker -> out
type encoding struct {
out io.Writer
breaker *lineBreaker
diff --git a/openpgp/elgamal/elgamal.go b/openpgp/elgamal/elgamal.go
index 84396a0..743b35a 100644
--- a/openpgp/elgamal/elgamal.go
+++ b/openpgp/elgamal/elgamal.go
@@ -77,8 +77,8 @@
// returns the plaintext of the message. An error can result only if the
// ciphertext is invalid. Users should keep in mind that this is a padding
// oracle and thus, if exposed to an adaptive chosen ciphertext attack, can
-// be used to break the cryptosystem. See ``Chosen Ciphertext Attacks
-// Against Protocols Based on the RSA Encryption Standard PKCS #1'', Daniel
+// be used to break the cryptosystem. See “Chosen Ciphertext Attacks
+// Against Protocols Based on the RSA Encryption Standard PKCS #1”, Daniel
// Bleichenbacher, Advances in Cryptology (Crypto '98),
func Decrypt(priv *PrivateKey, c1, c2 *big.Int) (msg []byte, err error) {
s := new(big.Int).Exp(c1, priv.X, priv.P)
diff --git a/openpgp/packet/signature_v3_test.go b/openpgp/packet/signature_v3_test.go
index ad7b62a..73b46ae 100644
--- a/openpgp/packet/signature_v3_test.go
+++ b/openpgp/packet/signature_v3_test.go
@@ -66,18 +66,23 @@
// keySigV3Armor is some V3 public key I found in an SKS dump.
// Old: Public Key Packet(tag 6)(141 bytes)
-// Ver 4 - new
-// Public key creation time - Fri Sep 16 17:13:54 CDT 1994
-// Pub alg - unknown(pub 0)
-// Unknown public key(pub 0)
+//
+// Ver 4 - new
+// Public key creation time - Fri Sep 16 17:13:54 CDT 1994
+// Pub alg - unknown(pub 0)
+// Unknown public key(pub 0)
+//
// Old: User ID Packet(tag 13)(39 bytes)
-// User ID - Armin M. Warda <wa...@nephilim.ruhr.de>
+//
+// User ID - Armin M. Warda <wa...@nephilim.ruhr.de>
+//
// Old: Signature Packet(tag 2)(149 bytes)
-// Ver 4 - new
-// Sig type - unknown(05)
-// Pub alg - ElGamal Encrypt-Only(pub 16)
-// Hash alg - unknown(hash 46)
-// Hashed Sub: unknown(sub 81, critical)(1988 bytes)
+//
+// Ver 4 - new
+// Sig type - unknown(05)
+// Pub alg - ElGamal Encrypt-Only(pub 16)
+// Hash alg - unknown(hash 46)
+// Hashed Sub: unknown(sub 81, critical)(1988 bytes)
const keySigV3Armor = `-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.0.10
diff --git a/pbkdf2/pbkdf2.go b/pbkdf2/pbkdf2.go
index 593f653..904b57e 100644
--- a/pbkdf2/pbkdf2.go
+++ b/pbkdf2/pbkdf2.go
@@ -32,7 +32,7 @@
// can get a derived key for e.g. AES-256 (which needs a 32-byte key) by
// doing:
//
-// dk := pbkdf2.Key([]byte("some password"), salt, 4096, 32, sha1.New)
+// dk := pbkdf2.Key([]byte("some password"), salt, 4096, 32, sha1.New)
//
// Remember to get a good random salt. At least 8 bytes is recommended by the
// RFC.
diff --git a/scrypt/scrypt.go b/scrypt/scrypt.go
index bbe4494..c971a99 100644
--- a/scrypt/scrypt.go
+++ b/scrypt/scrypt.go
@@ -186,7 +186,7 @@
// For example, you can get a derived key for e.g. AES-256 (which needs a
// 32-byte key) by doing:
//
-// dk, err := scrypt.Key([]byte("some password"), salt, 32768, 8, 1, 32)
+// dk, err := scrypt.Key([]byte("some password"), salt, 32768, 8, 1, 32)
//
// The recommended parameters for interactive logins as of 2017 are N=32768, r=8
// and p=1. The parameters N, r, and p should be increased as memory latency and
diff --git a/sha3/doc.go b/sha3/doc.go
index c2fef30..decd8cf 100644
--- a/sha3/doc.go
+++ b/sha3/doc.go
@@ -8,8 +8,7 @@
// Both types of hash function use the "sponge" construction and the Keccak
// permutation. For a detailed specification see http://keccak.noekeon.org/
//
-//
-// Guidance
+// # Guidance
//
// If you aren't sure what function you need, use SHAKE256 with at least 64
// bytes of output. The SHAKE instances are faster than the SHA3 instances;
@@ -19,8 +18,7 @@
// secret key to the input, hash with SHAKE256 and read at least 32 bytes of
// output.
//
-//
-// Security strengths
+// # Security strengths
//
// The SHA3-x (x equals 224, 256, 384, or 512) functions have a security
// strength against preimage attacks of x bits. Since they only produce "x"
@@ -31,8 +29,7 @@
// is used. Requesting more than 64 or 32 bytes of output, respectively, does
// not increase the collision-resistance of the SHAKE functions.
//
-//
-// The sponge construction
+// # The sponge construction
//
// A sponge builds a pseudo-random function from a public pseudo-random
// permutation, by applying the permutation to a state of "rate + capacity"
@@ -50,8 +47,7 @@
// Since the KeccakF-1600 permutation is 1600 bits (200 bytes) wide, this means
// that the security strength of a sponge instance is equal to (1600 - bitrate) / 2.
//
-//
-// Recommendations
+// # Recommendations
//
// The SHAKE functions are recommended for most new uses. They can produce
// output of arbitrary length. SHAKE256, with an output length of at least
diff --git a/sha3/sha3_s390x.go b/sha3/sha3_s390x.go
index 4fcfc92..63a3edb 100644
--- a/sha3/sha3_s390x.go
+++ b/sha3/sha3_s390x.go
@@ -34,11 +34,13 @@
// kimd is a wrapper for the 'compute intermediate message digest' instruction.
// src must be a multiple of the rate for the given function code.
+//
//go:noescape
func kimd(function code, chain *[200]byte, src []byte)
// klmd is a wrapper for the 'compute last message digest' instruction.
// src padding is handled by the instruction.
+//
//go:noescape
func klmd(function code, chain *[200]byte, dst, src []byte)
diff --git a/ssh/agent/client.go b/ssh/agent/client.go
index 3cfe723..dbc79d5 100644
--- a/ssh/agent/client.go
+++ b/ssh/agent/client.go
@@ -8,7 +8,8 @@
// ssh-agent process using the sample server.
//
// References:
-// [PROTOCOL.agent]: https://tools.ietf.org/html/draft-miller-ssh-agent-00
+//
+// [PROTOCOL.agent]: https://tools.ietf.org/html/draft-miller-ssh-agent-00
package agent // import "golang.org/x/crypto/ssh/agent"
import (
diff --git a/ssh/certs_test.go b/ssh/certs_test.go
index ba6dbca..e600483 100644
--- a/ssh/certs_test.go
+++ b/ssh/certs_test.go
@@ -49,14 +49,17 @@
// % ssh-keygen -s ca -I testcert -O source-address=192.168.1.0/24 -O force-command=/bin/sleep user.pub
// user.pub key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMN
// Critical Options:
-// force-command /bin/sleep
-// source-address 192.168.1.0/24
+//
+// force-command /bin/sleep
+// source-address 192.168.1.0/24
+//
// Extensions:
-// permit-X11-forwarding
-// permit-agent-forwarding
-// permit-port-forwarding
-// permit-pty
-// permit-user-rc
+//
+// permit-X11-forwarding
+// permit-agent-forwarding
+// permit-port-forwarding
+// permit-pty
+// permit-user-rc
const exampleSSHCertWithOptions = `ssh-rsa-...@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgDyysCJY0XrO1n03EeRRoITnTPdjENFmWDs9X58PP3VUAAAADAQABAAABAQDACh1rt2DXfV3hk6fszSQcQ/rueMId0kVD9U7nl8cfEnFxqOCrNT92g4laQIGl2mn8lsGZfTLg8ksHq3gkvgO3oo/0wHy4v32JeBOHTsN5AL4gfHNEhWeWb50ev47hnTsRIt9P4dxogeUo/hTu7j9+s9lLpEQXCvq6xocXQt0j8MV9qZBBXFLXVT3cWIkSqOdwt/5ZBg+1GSrc7WfCXVWgTk4a20uPMuJPxU4RQwZW6X3+O8Pqo8C3cW0OzZRFP6gUYUKUsTI5WntlS+LAxgw1mZNsozFGdbiOPRnEryE3SRldh9vjDR3tin1fGpA5P7+CEB/bqaXtG3V+F2OkqaMNAAAAAAAAAAAAAAABAAAACHRlc3RjZXJ0AAAAAAAAAAAAAAAA//////////8AAABLAAAADWZvcmNlLWNvbW1hbmQAAAAOAAAACi9iaW4vc2xlZXAAAAAOc291cmNlLWFkZHJlc3MAAAASAAAADjE5Mi4xNjguMS4wLzI0AAAAggAAABVwZXJtaXQtWDExLWZvcndhcmRpbmcAAAAAAAAAF3Blcm1pdC1hZ2VudC1mb3J3YXJkaW5nAAAAAAAAABZwZXJtaXQtcG9ydC1mb3J3YXJkaW5nAAAAAAAAAApwZXJtaXQtcHR5AAAAAAAAAA5wZXJtaXQtdXNlci1yYwAAAAAAAAAAAAABFwAAAAdzc2gtcnNhAAAAAwEAAQAAAQEAwU+c5ui5A8+J/CFpjW8wCa52bEODA808WWQDCSuTG/eMXNf59v9Y8Pk0F1E9dGCosSNyVcB/hacUrc6He+i97+HJCyKavBsE6GDxrjRyxYqAlfcOXi/IVmaUGiO8OQ39d4GHrjToInKvExSUeleQyH4Y4/e27T/pILAqPFL3fyrvMLT5qU9QyIt6zIpa7GBP5+urouNavMprV3zsfIqNBbWypinOQAw823a5wN+zwXnhZrgQiHZ/USG09Y6k98y1dTVz8YHlQVR4D3lpTAsKDKJ5hCH9WU4fdf+lU8OyNGaJ/vz0XNqxcToe1l4numLTnaoSuH89pHryjqurB7lJKwAAAQ8AAAAHc3NoLXJzYQAAAQCaHvUIoPL1zWUHIXLvu96/HU1s/i4CAW2IIEuGgxCUCiFj6vyTyYtgxQxcmbfZf6eaITlS6XJZa7Qq4iaFZh75C1DXTX8labXhRSD4E2t//AIP9MC1rtQC5xo6FmbQ+BoKcDskr+mNACcbRSxs3IL3bwCfWDnIw2WbVox9ZdcthJKk4UoCW4ix4QwdHw7zlddlz++fGEEVhmTbll1SUkycGApPFBsAYRTMupUJcYPIeReBI/m8XfkoMk99bV8ZJQTAd7OekHY2/48Ff53jLmyDjP7kNw1F8OaPtkFs6dGJXta4krmaekPy87j+35In5hFj7yoOqvSbmYUkeX70/GGQ`
func TestParseCertWithOptions(t *testing.T) {
diff --git a/ssh/cipher.go b/ssh/cipher.go
index f8bdf49..770e8a6 100644
--- a/ssh/cipher.go
+++ b/ssh/cipher.go
@@ -640,7 +640,7 @@
// chacha20Poly1305Cipher implements the chacha20...@openssh.com
// AEAD, which is described here:
//
-// https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00
+// https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00
//
// the methods here also implement padding, which RFC4253 Section 6
// also requires of stream ciphers.
diff --git a/ssh/doc.go b/ssh/doc.go
index 67b7322..f6bff60 100644
--- a/ssh/doc.go
+++ b/ssh/doc.go
@@ -12,8 +12,9 @@
others.
References:
- [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD
- [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1
+
+ [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD
+ [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1
This package does not fall under the stability promise of the Go language itself,
so its API may be changed when pressing needs arise.
To view, visit change 399356. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: I5fd6eaa2a711d27051045aaaef45799a12777e48
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/399605
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Roland Shoemaker <rol...@golang.org>
---
M client/client.go
M cmd/govulncheck/main.go
M vulncheck/binary_test.go
M vulncheck/helpers_test.go
M vulncheck/source.go
M vulncheck/source_test.go
M vulncheck/utils.go
7 files changed, 76 insertions(+), 54 deletions(-)
diff --git a/client/client.go b/client/client.go
index 592c9d3..da8b7c6 100644
--- a/client/client.go
+++ b/client/client.go
@@ -12,7 +12,7 @@
// was added. The index file is called indx.json, and has the
// following format:
//
-// map[string]time.Time (DBIndex)
+// map[string]time.Time (DBIndex)
//
// Each vulnerable module is represented by an individual JSON file
// which contains all of the vulnerabilities in that module. The path
@@ -21,7 +21,7 @@
// golang.org/x/crypto.json file. The per-module JSON files have
// the following format:
//
-// []osv.Entry
+// []osv.Entry
//
// A single client.Client can be used to access multiple vulnerability
// databases. When looking up vulnerable module each database is
diff --git a/cmd/govulncheck/main.go b/cmd/govulncheck/main.go
index 82c86b0..3c79af4 100644
--- a/cmd/govulncheck/main.go
+++ b/cmd/govulncheck/main.go
@@ -11,7 +11,7 @@
// It uses static analysis or the binary's symbol table to narrow down reports to only
// those that potentially affect the application.
//
-// WARNING WARNING WARNING
+// # WARNING WARNING WARNING
//
// govulncheck is still experimental and neither its output or the vulnerability
// database should be relied on to be stable or comprehensive.
@@ -290,10 +290,11 @@
// summarizeCallStack returns a short description of the call stack.
// It uses one of two forms, depending on what the lowest function F in topPkgs
// calls:
-// - If it calls a function V from the vulnerable package, then summarizeCallStack
-// returns "F calls V".
-// - If it calls a function G in some other package, which eventually calls V,
-// it returns "F calls G, which eventually calls V".
+// - If it calls a function V from the vulnerable package, then summarizeCallStack
+// returns "F calls V".
+// - If it calls a function G in some other package, which eventually calls V,
+// it returns "F calls G, which eventually calls V".
+//
// If it can't find any of these functions, summarizeCallStack returns the empty string.
func summarizeCallStack(cs vulncheck.CallStack, topPkgs map[string]bool, vulnPkg string) string {
// Find the lowest function in the top packages.
diff --git a/vulncheck/binary_test.go b/vulncheck/binary_test.go
index 1d5210c..4b6c0c3 100644
--- a/vulncheck/binary_test.go
+++ b/vulncheck/binary_test.go
@@ -131,7 +131,7 @@
}
}
-// hasGoBuild reports whether the current system can build programs with ``go build''
+// hasGoBuild reports whether the current system can build programs with “go build”
// and then run them with os.StartProcess or exec.Command.
//
// Duplicated from std/internal/testenv
diff --git a/vulncheck/helpers_test.go b/vulncheck/helpers_test.go
index ddfe8ec..c7f0805 100644
--- a/vulncheck/helpers_test.go
+++ b/vulncheck/helpers_test.go
@@ -25,8 +25,9 @@
}
// testClient contains the following test vulnerabilities
-// golang.org/amod/avuln.{VulnData.Vuln1, vulnData.Vuln2}
-// golang.org/bmod/bvuln.{Vuln}
+//
+// golang.org/amod/avuln.{VulnData.Vuln1, vulnData.Vuln2}
+// golang.org/bmod/bvuln.{Vuln}
var testClient = &mockClient{
ret: map[string][]*osv.Entry{
"golang.org/amod": []*osv.Entry{
diff --git a/vulncheck/source.go b/vulncheck/source.go
index 0d106dd..55f3777 100644
--- a/vulncheck/source.go
+++ b/vulncheck/source.go
@@ -17,12 +17,12 @@
)
// Source detects vulnerabilities in pkgs and computes slices of
-// - imports graph related to an import of a package with some
-// known vulnerabilities
-// - requires graph related to a require of a module with a
-// package that has some known vulnerabilities
-// - call graph leading to the use of a known vulnerable function
-// or method
+// - imports graph related to an import of a package with some
+// known vulnerabilities
+// - requires graph related to a require of a module with a
+// package that has some known vulnerabilities
+// - call graph leading to the use of a known vulnerable function
+// or method
func Source(ctx context.Context, pkgs []*Package, cfg *Config) (_ *Result, err error) {
defer derrors.Wrap(&err, "vulncheck.Source")
diff --git a/vulncheck/source_test.go b/vulncheck/source_test.go
index 6d65706..0ded4dc 100644
--- a/vulncheck/source_test.go
+++ b/vulncheck/source_test.go
@@ -19,13 +19,13 @@
// for the Config.ImportsOnly=true mode. The inlined test code has
// the following package (left) and module (right) imports graphs:
//
-// entry/x entry/y entry
-// \ / \ / \
-// amod/avuln zmod/z amod zmod
-// | |
-// wmod/w wmod
-// | |
-// bmod/bvuln bmod
+// entry/x entry/y entry
+// \ / \ / \
+// amod/avuln zmod/z amod zmod
+// | |
+// wmod/w wmod
+// | |
+// bmod/bvuln bmod
//
// Packages ending in "vuln" have some known vulnerabilities.
func TestImportsOnly(t *testing.T) {
@@ -171,37 +171,38 @@
// TestCallGraph checks for call graph vuln slicing correctness.
// The inlined test code has the following call graph
//
-// x.X
-// / | \
-// / d.D1 avuln.VulnData.Vuln1
-// / / |
-// c.C1 d.internal.Vuln1
-// |
-// avuln.VulnData.Vuln2
+// x.X
+// / | \
+// / d.D1 avuln.VulnData.Vuln1
+// / / |
+// c.C1 d.internal.Vuln1
+// |
+// avuln.VulnData.Vuln2
//
-// --------------------y.Y-------------------------------
-// / / \ \ \ \
-// / / \ \ \ \
-// / / \ \ \ \
-// c.C4 c.vulnWrap.V.Vuln1(=nil) c.C2 bvuln.Vuln c.C3 c.C3$1
-// | | |
-// y.benign e.E
+// --------------------y.Y-------------------------------
+// / / \ \ \ \
+// / / \ \ \ \
+// / / \ \ \ \
+// c.C4 c.vulnWrap.V.Vuln1(=nil) c.C2 bvuln.Vuln c.C3 c.C3$1
+// | | |
+// y.benign e.E
//
// and this slice
//
-// x.X
-// / | \
-// / d.D1 avuln.VulnData.Vuln1
-// / /
-// c.C1
-// |
-// avuln.VulnData.Vuln2
+// x.X
+// / | \
+// / d.D1 avuln.VulnData.Vuln1
+// / /
+// c.C1
+// |
+// avuln.VulnData.Vuln2
//
-// y.Y
-// |
-// bvuln.Vuln
-// | |
-// e.E
+// y.Y
+// |
+// bvuln.Vuln
+// | |
+// e.E
+//
// related to avuln.VulnData.{Vuln1, Vuln2} and bvuln.Vuln vulnerabilities.
func TestCallGraph(t *testing.T) {
e := packagestest.Export(t, packagestest.Modules, []packagestest.Module{
diff --git a/vulncheck/utils.go b/vulncheck/utils.go
index 780cd63..0886a27 100644
--- a/vulncheck/utils.go
+++ b/vulncheck/utils.go
@@ -98,8 +98,8 @@
// dbTypeFormat formats the name of t according how types
// are encoded in vulnerability database:
-// - pointer designation * is skipped
-// - full path prefix is skipped as well
+// - pointer designation * is skipped
+// - full path prefix is skipped as well
func dbTypeFormat(t types.Type) string {
switch tt := t.(type) {
case *types.Pointer:
@@ -118,9 +118,10 @@
// enclosing package, but not globally.
//
// Examples:
-// func (a A) foo (...) {...} -> A.foo
-// func foo(...) {...} -> foo
-// func (b *B) bar (...) {...} -> B.bar
+//
+// func (a A) foo (...) {...} -> A.foo
+// func foo(...) {...} -> foo
+// func (b *B) bar (...) {...} -> B.bar
func dbFuncName(f *ssa.Function) string {
selectBound := func(f *ssa.Function) types.Type {
// If f is a "bound" function introduced by ssa for a given type, return the type.
To view, visit change 399605. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ia9626b9086d6a0f5840ea0fc3dae8ed8bc4122e1
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/399606
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Reviewed-by: kokoro <noreply...@google.com>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Roland Shoemaker <rol...@golang.org>
---
M internal/cveschema/cveschema.go
M internal/worker/log/log.go
M internal/worker/paths.go
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/internal/cveschema/cveschema.go b/internal/cveschema/cveschema.go
index d119898..d63340b 100644
--- a/internal/cveschema/cveschema.go
+++ b/internal/cveschema/cveschema.go
@@ -132,7 +132,7 @@
//
// Descriptions often follow this template:
//
-// [PROBLEM TYPE] in [PRODUCT/VERSION] causes [IMPACT] when [ATTACK]
+// [PROBLEM TYPE] in [PRODUCT/VERSION] causes [IMPACT] when [ATTACK]
//
// where impact and attack are arbitrary terms that should be relevant to the
// nature of the vulnerability.
diff --git a/internal/worker/log/log.go b/internal/worker/log/log.go
index 2006af5..2e98142 100644
--- a/internal/worker/log/log.go
+++ b/internal/worker/log/log.go
@@ -20,7 +20,8 @@
// NewLineHandler returns an event Handler that writes log events one per line
// in an easy-to-read format:
-// time level message label1=value1 label2=value2 ...
+//
+// time level message label1=value1 label2=value2 ...
func NewLineHandler(w io.Writer) event.Handler {
return &lineHandler{w: w}
}
diff --git a/internal/worker/paths.go b/internal/worker/paths.go
index 3ef3fa1..0840053 100644
--- a/internal/worker/paths.go
+++ b/internal/worker/paths.go
@@ -34,9 +34,9 @@
}
// negativePrefixPatterns is a list of glob patterns that describe prefixes of
-// potential module paths that are known not to be modules. These are turned
-// into regexps below and checked against each module path before calling
-// pkgsite. This can speed up triage because pkgsite requests are throttled.
+// potential module paths that are known not to be modules. These are turned
+// into regexps below and checked against each module path before calling
+// pkgsite. This can speed up triage because pkgsite requests are throttled.
var negativePrefixPatterns = []string{
"*.blogspot.com",
"*.blogspot.dk",
To view, visit change 399606. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: I3e3c5666d5e901f2c5303911ddb548e3dd567fce
Reviewed-on: https://go-review.googlesource.com/c/text/+/399603
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M cases/gen_trieval.go
M cases/trieval.go
M cmd/gotext/doc.go
M collate/build/builder.go
M collate/build/colelem.go
M collate/build/contract.go
M feature/plural/gen.go
M feature/plural/message.go
M feature/plural/plural.go
M internal/catmsg/catmsg.go
M internal/cldrtree/cldrtree.go
M internal/colltab/collelem.go
M internal/export/idna/gen_trieval.go
M internal/export/idna/trieval.go
M internal/language/tables.go
M internal/number/decimal.go
M internal/testtext/codesize.go
M internal/triegen/triegen.go
M internal/utf8internal/utf8internal.go
M language/display/lookup.go
M language/doc.go
M message/catalog/catalog.go
M message/doc.go
M number/doc.go
M unicode/bidi/core.go
M unicode/cldr/collate.go
M unicode/norm/forminfo.go
M unicode/norm/maketables.go
M unicode/norm/normalize.go
M width/tables10.0.0.go
M width/tables11.0.0.go
M width/tables12.0.0.go
M width/tables13.0.0.go
M width/tables9.0.0.go
34 files changed, 546 insertions(+), 453 deletions(-)
diff --git a/cases/gen_trieval.go b/cases/gen_trieval.go
index 6c7222a..14dd33b 100644
--- a/cases/gen_trieval.go
+++ b/cases/gen_trieval.go
@@ -19,19 +19,19 @@
//
// The per-rune values have the following format:
//
-// if (exception) {
-// 15..4 unsigned exception index
-// } else {
-// 15..8 XOR pattern or index to XOR pattern for case mapping
-// Only 13..8 are used for XOR patterns.
-// 7 inverseFold (fold to upper, not to lower)
-// 6 index: interpret the XOR pattern as an index
-// or isMid if case mode is cIgnorableUncased.
-// 5..4 CCC: zero (normal or break), above or other
-// }
-// 3 exception: interpret this value as an exception index
-// (TODO: is this bit necessary? Probably implied from case mode.)
-// 2..0 case mode
+// if (exception) {
+// 15..4 unsigned exception index
+// } else {
+// 15..8 XOR pattern or index to XOR pattern for case mapping
+// Only 13..8 are used for XOR patterns.
+// 7 inverseFold (fold to upper, not to lower)
+// 6 index: interpret the XOR pattern as an index
+// or isMid if case mode is cIgnorableUncased.
+// 5..4 CCC: zero (normal or break), above or other
+// }
+// 3 exception: interpret this value as an exception index
+// (TODO: is this bit necessary? Probably implied from case mode.)
+// 2..0 case mode
//
// For the non-exceptional cases, a rune must be either uncased, lowercase or
// uppercase. If the rune is cased, the XOR pattern maps either a lowercase
@@ -133,37 +133,40 @@
// The entry is pointed to by the exception index in an entry. It has the
// following format:
//
-// Header
-// byte 0:
-// 7..6 unused
-// 5..4 CCC type (same bits as entry)
-// 3 unused
-// 2..0 length of fold
+// Header:
//
-// byte 1:
-// 7..6 unused
-// 5..3 length of 1st mapping of case type
-// 2..0 length of 2nd mapping of case type
+// byte 0:
+// 7..6 unused
+// 5..4 CCC type (same bits as entry)
+// 3 unused
+// 2..0 length of fold
//
-// case 1st 2nd
-// lower -> upper, title
-// upper -> lower, title
-// title -> lower, upper
+// byte 1:
+// 7..6 unused
+// 5..3 length of 1st mapping of case type
+// 2..0 length of 2nd mapping of case type
+//
+// case 1st 2nd
+// lower -> upper, title
+// upper -> lower, title
+// title -> lower, upper
//
// Lengths with the value 0x7 indicate no value and implies no change.
// A length of 0 indicates a mapping to zero-length string.
//
// Body bytes:
-// case folding bytes
-// lowercase mapping bytes
-// uppercase mapping bytes
-// titlecase mapping bytes
-// closure mapping bytes (for NFKC_Casefold). (TODO)
+//
+// case folding bytes
+// lowercase mapping bytes
+// uppercase mapping bytes
+// titlecase mapping bytes
+// closure mapping bytes (for NFKC_Casefold). (TODO)
//
// Fallbacks:
-// missing fold -> lower
-// missing title -> upper
-// all missing -> original rune
+//
+// missing fold -> lower
+// missing title -> upper
+// all missing -> original rune
//
// exceptions starts with a dummy byte to enforce that there is no zero index
// value.
diff --git a/cases/trieval.go b/cases/trieval.go
index 99e0396..4e4d13f 100644
--- a/cases/trieval.go
+++ b/cases/trieval.go
@@ -14,19 +14,19 @@
//
// The per-rune values have the following format:
//
-// if (exception) {
-// 15..4 unsigned exception index
-// } else {
-// 15..8 XOR pattern or index to XOR pattern for case mapping
-// Only 13..8 are used for XOR patterns.
-// 7 inverseFold (fold to upper, not to lower)
-// 6 index: interpret the XOR pattern as an index
-// or isMid if case mode is cIgnorableUncased.
-// 5..4 CCC: zero (normal or break), above or other
-// }
-// 3 exception: interpret this value as an exception index
-// (TODO: is this bit necessary? Probably implied from case mode.)
-// 2..0 case mode
+// if (exception) {
+// 15..4 unsigned exception index
+// } else {
+// 15..8 XOR pattern or index to XOR pattern for case mapping
+// Only 13..8 are used for XOR patterns.
+// 7 inverseFold (fold to upper, not to lower)
+// 6 index: interpret the XOR pattern as an index
+// or isMid if case mode is cIgnorableUncased.
+// 5..4 CCC: zero (normal or break), above or other
+// }
+// 3 exception: interpret this value as an exception index
+// (TODO: is this bit necessary? Probably implied from case mode.)
+// 2..0 case mode
//
// For the non-exceptional cases, a rune must be either uncased, lowercase or
// uppercase. If the rune is cased, the XOR pattern maps either a lowercase
@@ -128,37 +128,40 @@
// The entry is pointed to by the exception index in an entry. It has the
// following format:
//
-// Header
-// byte 0:
-// 7..6 unused
-// 5..4 CCC type (same bits as entry)
-// 3 unused
-// 2..0 length of fold
+// Header:
//
-// byte 1:
-// 7..6 unused
-// 5..3 length of 1st mapping of case type
-// 2..0 length of 2nd mapping of case type
+// byte 0:
+// 7..6 unused
+// 5..4 CCC type (same bits as entry)
+// 3 unused
+// 2..0 length of fold
//
-// case 1st 2nd
-// lower -> upper, title
-// upper -> lower, title
-// title -> lower, upper
+// byte 1:
+// 7..6 unused
+// 5..3 length of 1st mapping of case type
+// 2..0 length of 2nd mapping of case type
+//
+// case 1st 2nd
+// lower -> upper, title
+// upper -> lower, title
+// title -> lower, upper
//
// Lengths with the value 0x7 indicate no value and implies no change.
// A length of 0 indicates a mapping to zero-length string.
//
// Body bytes:
-// case folding bytes
-// lowercase mapping bytes
-// uppercase mapping bytes
-// titlecase mapping bytes
-// closure mapping bytes (for NFKC_Casefold). (TODO)
+//
+// case folding bytes
+// lowercase mapping bytes
+// uppercase mapping bytes
+// titlecase mapping bytes
+// closure mapping bytes (for NFKC_Casefold). (TODO)
//
// Fallbacks:
-// missing fold -> lower
-// missing title -> upper
-// all missing -> original rune
+//
+// missing fold -> lower
+// missing title -> upper
+// all missing -> original rune
//
// exceptions starts with a dummy byte to enforce that there is no zero index
// value.
diff --git a/cmd/gotext/doc.go b/cmd/gotext/doc.go
index fa247c6..d363ae2 100644
--- a/cmd/gotext/doc.go
+++ b/cmd/gotext/doc.go
@@ -4,60 +4,47 @@
//
// Usage:
//
-// gotext command [arguments]
+// gotext command [arguments]
//
// The commands are:
//
-// update merge translations and generate catalog
-// extract extracts strings to be translated from code
-// rewrite rewrites fmt functions to use a message Printer
-// generate generates code to insert translated messages
+// update merge translations and generate catalog
+// extract extracts strings to be translated from code
+// rewrite rewrites fmt functions to use a message Printer
+// generate generates code to insert translated messages
//
// Use "gotext help [command]" for more information about a command.
//
// Additional help topics:
//
-//
// Use "gotext help [topic]" for more information about that topic.
//
-//
-// Merge translations and generate catalog
+// # Merge translations and generate catalog
//
// Usage:
//
-// gotext update <package>* [-out <gofile>]
+// gotext update <package>* [-out <gofile>]
//
-//
-//
-//
-// Extracts strings to be translated from code
+// # Extracts strings to be translated from code
//
// Usage:
//
-// gotext extract <package>*
+// gotext extract <package>*
//
-//
-//
-//
-// Rewrites fmt functions to use a message Printer
+// # Rewrites fmt functions to use a message Printer
//
// Usage:
//
-// gotext rewrite <package>
+// gotext rewrite <package>
//
// rewrite is typically done once for a project. It rewrites all usages of
// fmt to use x/text's message package whenever a message.Printer is in scope.
// It rewrites Print and Println calls with constant strings to the equivalent
// using Printf to allow translators to reorder arguments.
//
-//
-// Generates code to insert translated messages
+// # Generates code to insert translated messages
//
// Usage:
//
-// gotext generate <package>
-//
-//
-//
-//
+// gotext generate <package>
package main
diff --git a/collate/build/builder.go b/collate/build/builder.go
index 092a4b5..3efb738 100644
--- a/collate/build/builder.go
+++ b/collate/build/builder.go
@@ -225,26 +225,37 @@
//
// Examples: create a tailoring for Swedish, where "ä" is ordered after "z"
// at the primary sorting level:
-// t := b.Tailoring("se")
-// t.SetAnchor("z")
-// t.Insert(colltab.Primary, "ä", "")
+//
+// t := b.Tailoring("se")
+// t.SetAnchor("z")
+// t.Insert(colltab.Primary, "ä", "")
+//
// Order "ü" after "ue" at the secondary sorting level:
-// t.SetAnchor("ue")
-// t.Insert(colltab.Secondary, "ü","")
+//
+// t.SetAnchor("ue")
+// t.Insert(colltab.Secondary, "ü","")
+//
// or
-// t.SetAnchor("u")
-// t.Insert(colltab.Secondary, "ü", "e")
+//
+// t.SetAnchor("u")
+// t.Insert(colltab.Secondary, "ü", "e")
+//
// Order "q" afer "ab" at the secondary level and "Q" after "q"
// at the tertiary level:
-// t.SetAnchor("ab")
-// t.Insert(colltab.Secondary, "q", "")
-// t.Insert(colltab.Tertiary, "Q", "")
+//
+// t.SetAnchor("ab")
+// t.Insert(colltab.Secondary, "q", "")
+// t.Insert(colltab.Tertiary, "Q", "")
+//
// Order "b" before "a":
-// t.SetAnchorBefore("a")
-// t.Insert(colltab.Primary, "b", "")
+//
+// t.SetAnchorBefore("a")
+// t.Insert(colltab.Primary, "b", "")
+//
// Order "0" after the last primary ignorable:
-// t.SetAnchor("<last_primary_ignorable/>")
-// t.Insert(colltab.Primary, "0", "")
+//
+// t.SetAnchor("<last_primary_ignorable/>")
+// t.Insert(colltab.Primary, "0", "")
func (t *Tailoring) Insert(level colltab.Level, str, extend string) error {
if t.anchor == nil {
return fmt.Errorf("%s:Insert: no anchor point set for tailoring of %s", t.id, str)
diff --git a/collate/build/colelem.go b/collate/build/colelem.go
index 04fc3bf..1aaa062 100644
--- a/collate/build/colelem.go
+++ b/collate/build/colelem.go
@@ -51,6 +51,7 @@
// - n* is the size of the first node in the contraction trie.
// - i* is the index of the first node in the contraction trie.
// - b* is the offset into the contraction collation element table.
+//
// See contract.go for details on the contraction trie.
const (
contractID = 0xC0000000
@@ -103,7 +104,8 @@
// The collation element, in this case, is of the form
// 11110000 00000000 wwwwwwww vvvvvvvv, where
// - v* is the replacement tertiary weight for the first rune,
-// - w* is the replacement tertiary weight for the second rune,
+// - w* is the replacement tertiary weight for the second rune.
+//
// Tertiary weights of subsequent runes should be replaced with maxTertiary.
// See https://www.unicode.org/reports/tr10/#Compatibility_Decompositions for more details.
const (
@@ -162,7 +164,9 @@
// primaries (either double primaries or for illegal runes)
// to our own representation.
// A CJK character C is represented in the DUCET as
-// [.FBxx.0020.0002.C][.BBBB.0000.0000.C]
+//
+// [.FBxx.0020.0002.C][.BBBB.0000.0000.C]
+//
// We will rewrite these characters to a single CE.
// We assume the CJK values start at 0x8000.
// See https://unicode.org/reports/tr10/#Implicit_Weights
diff --git a/collate/build/contract.go b/collate/build/contract.go
index e2df64f..5d79eb8 100644
--- a/collate/build/contract.go
+++ b/collate/build/contract.go
@@ -56,19 +56,22 @@
// entry might still resemble a completed suffix.
// Examples:
// The suffix strings "ab" and "ac" can be represented as:
-// []ctEntry{
-// {'a', 1, 1, noIndex}, // 'a' by itself does not match, so i is 0xFF.
-// {'b', 'c', 0, 1}, // "ab" -> 1, "ac" -> 2
-// }
+//
+// []ctEntry{
+// {'a', 1, 1, noIndex}, // 'a' by itself does not match, so i is 0xFF.
+// {'b', 'c', 0, 1}, // "ab" -> 1, "ac" -> 2
+// }
//
// The suffix strings "ab", "abc", "abd", and "abcd" can be represented as:
-// []ctEntry{
-// {'a', 1, 1, noIndex}, // 'a' must be followed by 'b'.
-// {'b', 1, 2, 1}, // "ab" -> 1, may be followed by 'c' or 'd'.
-// {'d', 'd', final, 3}, // "abd" -> 3
-// {'c', 4, 1, 2}, // "abc" -> 2, may be followed by 'd'.
-// {'d', 'd', final, 4}, // "abcd" -> 4
-// }
+//
+// []ctEntry{
+// {'a', 1, 1, noIndex}, // 'a' must be followed by 'b'.
+// {'b', 1, 2, 1}, // "ab" -> 1, may be followed by 'c' or 'd'.
+// {'d', 'd', final, 3}, // "abd" -> 3
+// {'c', 4, 1, 2}, // "abc" -> 2, may be followed by 'd'.
+// {'d', 'd', final, 4}, // "abcd" -> 4
+// }
+//
// See genStateTests in contract_test.go for more examples.
type ctEntry struct {
L uint8 // non-final: byte value to match; final: lowest match in range.
diff --git a/feature/plural/gen.go b/feature/plural/gen.go
index b9c5f24..5f8f375 100644
--- a/feature/plural/gen.go
+++ b/feature/plural/gen.go
@@ -359,15 +359,16 @@
// the resulting or conditions to conds.
//
// Example rules:
-// // Category "one" in English: only allow 1 with no visible fraction
-// i = 1 and v = 0 @integer 1
//
-// // Category "few" in Czech: all numbers with visible fractions
-// v != 0 @decimal ...
+// // Category "one" in English: only allow 1 with no visible fraction
+// i = 1 and v = 0 @integer 1
//
-// // Category "zero" in Latvian: all multiples of 10 or the numbers 11-19 or
-// // numbers with a fraction 11..19 and no trailing zeros.
-// n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19 @integer ...
+// // Category "few" in Czech: all numbers with visible fractions
+// v != 0 @decimal ...
+//
+// // Category "zero" in Latvian: all multiples of 10 or the numbers 11-19 or
+// // numbers with a fraction 11..19 and no trailing zeros.
+// n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19 @integer ...
//
// @integer and @decimal are followed by examples and are not relevant for the
// rule itself. The are used here to signal the termination of the rule.
diff --git a/feature/plural/message.go b/feature/plural/message.go
index f931f8a..6248d01 100644
--- a/feature/plural/message.go
+++ b/feature/plural/message.go
@@ -35,13 +35,13 @@
// The cases argument are pairs of selectors and messages. Selectors are of type
// string or Form. Messages are of type string or catalog.Message. A selector
// matches an argument if:
-// - it is "other" or Other
-// - it matches the plural form of the argument: "zero", "one", "two", "few",
-// or "many", or the equivalent Form
-// - it is of the form "=x" where x is an integer that matches the value of
-// the argument.
-// - it is of the form "<x" where x is an integer that is larger than the
-// argument.
+// - it is "other" or Other
+// - it matches the plural form of the argument: "zero", "one", "two", "few",
+// or "many", or the equivalent Form
+// - it is of the form "=x" where x is an integer that matches the value of
+// the argument.
+// - it is of the form "<x" where x is an integer that is larger than the
+// argument.
//
// The format argument determines the formatting parameters for which to
// determine the plural form. This is especially relevant for non-integer
diff --git a/feature/plural/plural.go b/feature/plural/plural.go
index 5b521b1..e9f2d42 100644
--- a/feature/plural/plural.go
+++ b/feature/plural/plural.go
@@ -20,7 +20,6 @@
// Rules defines the plural rules for all languages for a certain plural type.
//
-//
// This package is UNDER CONSTRUCTION and its API may change.
type Rules struct {
rules []pluralCheck
@@ -54,19 +53,19 @@
// getIntApprox converts the digits in slice digits[start:end] to an integer
// according to the following rules:
-// - Let i be asInt(digits[start:end]), where out-of-range digits are assumed
-// to be zero.
-// - Result n is big if i / 10^nMod > 1.
-// - Otherwise the result is i % 10^nMod.
+// - Let i be asInt(digits[start:end]), where out-of-range digits are assumed
+// to be zero.
+// - Result n is big if i / 10^nMod > 1.
+// - Otherwise the result is i % 10^nMod.
//
// For example, if digits is {1, 2, 3} and start:end is 0:5, then the result
// for various values of nMod is:
-// - when nMod == 2, n == big
-// - when nMod == 3, n == big
-// - when nMod == 4, n == big
-// - when nMod == 5, n == 12300
-// - when nMod == 6, n == 12300
-// - when nMod == 7, n == 12300
+// - when nMod == 2, n == big
+// - when nMod == 3, n == big
+// - when nMod == 4, n == big
+// - when nMod == 5, n == 12300
+// - when nMod == 6, n == 12300
+// - when nMod == 7, n == 12300
func getIntApprox(digits []byte, start, end, nMod, big int) (n int) {
// Leading 0 digits just result in 0.
p := start
@@ -107,12 +106,13 @@
//
// The following table contains examples of possible arguments to represent
// the given numbers.
-// decimal digits exp scale
-// 123 []byte{1, 2, 3} 3 0
-// 123.4 []byte{1, 2, 3, 4} 3 1
-// 123.40 []byte{1, 2, 3, 4} 3 2
-// 100000 []byte{1} 6 0
-// 100000.00 []byte{1} 6 3
+//
+// decimal digits exp scale
+// 123 []byte{1, 2, 3} 3 0
+// 123.4 []byte{1, 2, 3, 4} 3 1
+// 123.40 []byte{1, 2, 3, 4} 3 2
+// 100000 []byte{1} 6 0
+// 100000.00 []byte{1} 6 3
func (p *Rules) MatchDigits(t language.Tag, digits []byte, exp, scale int) Form {
index := tagToID(t)
@@ -152,14 +152,15 @@
// MatchPlural returns the plural form for the given language and plural
// operands (as defined in
// https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules):
-// where
-// n absolute value of the source number (integer and decimals)
-// input
-// i integer digits of n.
-// v number of visible fraction digits in n, with trailing zeros.
-// w number of visible fraction digits in n, without trailing zeros.
-// f visible fractional digits in n, with trailing zeros (f = t * 10^(v-w))
-// t visible fractional digits in n, without trailing zeros.
+//
+// where
+// n absolute value of the source number (integer and decimals)
+// input
+// i integer digits of n.
+// v number of visible fraction digits in n, with trailing zeros.
+// w number of visible fraction digits in n, without trailing zeros.
+// f visible fractional digits in n, with trailing zeros (f = t * 10^(v-w))
+// t visible fractional digits in n, without trailing zeros.
//
// If any of the operand values is too large to fit in an int, it is okay to
// pass the value modulo 10,000,000.
diff --git a/internal/catmsg/catmsg.go b/internal/catmsg/catmsg.go
index c0bf86f..1b257a7 100644
--- a/internal/catmsg/catmsg.go
+++ b/internal/catmsg/catmsg.go
@@ -9,8 +9,7 @@
// own. For instance, the plural package provides functionality for selecting
// translation strings based on the plural category of substitution arguments.
//
-//
-// Encoding and Decoding
+// # Encoding and Decoding
//
// Catalogs store Messages encoded as a single string. Compiling a message into
// a string both results in compacter representation and speeds up evaluation.
@@ -25,8 +24,7 @@
// the message. This decoder takes a Decoder argument which provides the
// counterparts for the decoding.
//
-//
-// Renderers
+// # Renderers
//
// A Decoder must be initialized with a Renderer implementation. These
// implementations must be provided by packages that use Catalogs, typically
@@ -38,22 +36,22 @@
// as sequence of substrings passed to the Renderer. The following snippet shows
// how to express the above example using the message package.
//
-// message.Set(language.English, "You are %d minute(s) late.",
-// catalog.Var("minutes", plural.Select(1, "one", "minute")),
-// catalog.String("You are %[1]d ${minutes} late."))
+// message.Set(language.English, "You are %d minute(s) late.",
+// catalog.Var("minutes", plural.Select(1, "one", "minute")),
+// catalog.String("You are %[1]d ${minutes} late."))
//
-// p := message.NewPrinter(language.English)
-// p.Printf("You are %d minute(s) late.", 5) // always 5 minutes late.
+// p := message.NewPrinter(language.English)
+// p.Printf("You are %d minute(s) late.", 5) // always 5 minutes late.
//
// To evaluate the Printf, package message wraps the arguments in a Renderer
// that is passed to the catalog for message decoding. The call sequence that
// results from evaluating the above message, assuming the person is rather
// tardy, is:
//
-// Render("You are %[1]d ")
-// Arg(1)
-// Render("minutes")
-// Render(" late.")
+// Render("You are %[1]d ")
+// Arg(1)
+// Render("minutes")
+// Render(" late.")
//
// The calls to Arg is caused by the plural.Select execution, which evaluates
// the argument to determine whether the singular or plural message form should
@@ -267,10 +265,12 @@
// Var defines a message that can be substituted for a placeholder of the same
// name. If an expression does not result in a string after evaluation, Name is
// used as the substitution. For example:
-// Var{
-// Name: "minutes",
-// Message: plural.Select(1, "one", "minute"),
-// }
+//
+// Var{
+// Name: "minutes",
+// Message: plural.Select(1, "one", "minute"),
+// }
+//
// will resolve to minute for singular and minutes for plural forms.
type Var struct {
Name string
@@ -318,13 +318,15 @@
// calls for each placeholder and interstitial string. For example, for the
// message: "%[1]v ${invites} %[2]v to ${their} party." The sequence of calls
// is:
-// d.Render("%[1]v ")
-// d.Arg(1)
-// d.Render(resultOfInvites)
-// d.Render(" %[2]v to ")
-// d.Arg(2)
-// d.Render(resultOfTheir)
-// d.Render(" party.")
+//
+// d.Render("%[1]v ")
+// d.Arg(1)
+// d.Render(resultOfInvites)
+// d.Render(" %[2]v to ")
+// d.Arg(2)
+// d.Render(resultOfTheir)
+// d.Render(" party.")
+//
// where the messages for "invites" and "their" both use a plural.Select
// referring to the first argument.
//
diff --git a/internal/cldrtree/cldrtree.go b/internal/cldrtree/cldrtree.go
index 7530831..cc2714e 100644
--- a/internal/cldrtree/cldrtree.go
+++ b/internal/cldrtree/cldrtree.go
@@ -4,7 +4,6 @@
// Package cldrtree builds and generates a CLDR index file, including all
// inheritance.
-//
package cldrtree
//go:generate go test -gen
diff --git a/internal/colltab/collelem.go b/internal/colltab/collelem.go
index 396cebd..0c23c8a 100644
--- a/internal/colltab/collelem.go
+++ b/internal/colltab/collelem.go
@@ -78,24 +78,27 @@
// For normal collation elements, we assume that a collation element either has
// a primary or non-default secondary value, not both.
// Collation elements with a primary value are of the form
-// 01pppppp pppppppp ppppppp0 ssssssss
-// - p* is primary collation value
-// - s* is the secondary collation value
-// 00pppppp pppppppp ppppppps sssttttt, where
-// - p* is primary collation value
-// - s* offset of secondary from default value.
-// - t* is the tertiary collation value
-// 100ttttt cccccccc pppppppp pppppppp
-// - t* is the tertiar collation value
-// - c* is the canonical combining class
-// - p* is the primary collation value
+//
+// 01pppppp pppppppp ppppppp0 ssssssss
+// - p* is primary collation value
+// - s* is the secondary collation value
+// 00pppppp pppppppp ppppppps sssttttt, where
+// - p* is primary collation value
+// - s* offset of secondary from default value.
+// - t* is the tertiary collation value
+// 100ttttt cccccccc pppppppp pppppppp
+// - t* is the tertiar collation value
+// - c* is the canonical combining class
+// - p* is the primary collation value
+//
// Collation elements with a secondary value are of the form
-// 1010cccc ccccssss ssssssss tttttttt, where
-// - c* is the canonical combining class
-// - s* is the secondary collation value
-// - t* is the tertiary collation value
-// 11qqqqqq qqqqqqqq qqqqqqq0 00000000
-// - q* quaternary value
+//
+// 1010cccc ccccssss ssssssss tttttttt, where
+// - c* is the canonical combining class
+// - s* is the secondary collation value
+// - t* is the tertiary collation value
+// 11qqqqqq qqqqqqqq qqqqqqq0 00000000
+// - q* quaternary value
const (
ceTypeMask = 0xC0000000
ceTypeMaskExt = 0xE0000000
@@ -296,6 +299,7 @@
// - n* is the size of the first node in the contraction trie.
// - i* is the index of the first node in the contraction trie.
// - b* is the offset into the contraction collation element table.
+//
// See contract.go for details on the contraction trie.
const (
maxNBits = 4
@@ -326,6 +330,7 @@
// The Elem, in this case, is of the form 11110000 00000000 wwwwwwww vvvvvvvv, where
// - v* is the replacement tertiary weight for the first rune,
// - w* is the replacement tertiary weight for the second rune,
+//
// Tertiary weights of subsequent runes should be replaced with maxTertiary.
// See https://www.unicode.org/reports/tr10/#Compatibility_Decompositions for more details.
func splitDecompose(ce Elem) (t1, t2 uint8) {
diff --git a/internal/export/idna/gen_trieval.go b/internal/export/idna/gen_trieval.go
index 9d92407..501bfab 100644
--- a/internal/export/idna/gen_trieval.go
+++ b/internal/export/idna/gen_trieval.go
@@ -22,23 +22,23 @@
//
// The per-rune values have the following format:
//
-// if mapped {
-// if inlinedXOR {
-// 15..13 inline XOR marker
-// 12..11 unused
-// 10..3 inline XOR mask
-// } else {
-// 15..3 index into xor or mapping table
-// }
-// } else {
-// 15..14 unused
-// 13 mayNeedNorm
-// 12..11 attributes
-// 10..8 joining type
-// 7..3 category type
-// }
-// 2 use xor pattern
-// 1..0 mapped category
+// if mapped {
+// if inlinedXOR {
+// 15..13 inline XOR marker
+// 12..11 unused
+// 10..3 inline XOR mask
+// } else {
+// 15..3 index into xor or mapping table
+// }
+// } else {
+// 15..14 unused
+// 13 mayNeedNorm
+// 12..11 attributes
+// 10..8 joining type
+// 7..3 category type
+// }
+// 2 use xor pattern
+// 1..0 mapped category
//
// See the definitions below for a more detailed description of the various
// bits.
diff --git a/internal/export/idna/trieval.go b/internal/export/idna/trieval.go
index 7a8cf88..9c070a4 100644
--- a/internal/export/idna/trieval.go
+++ b/internal/export/idna/trieval.go
@@ -17,23 +17,23 @@
//
// The per-rune values have the following format:
//
-// if mapped {
-// if inlinedXOR {
-// 15..13 inline XOR marker
-// 12..11 unused
-// 10..3 inline XOR mask
-// } else {
-// 15..3 index into xor or mapping table
-// }
-// } else {
-// 15..14 unused
-// 13 mayNeedNorm
-// 12..11 attributes
-// 10..8 joining type
-// 7..3 category type
-// }
-// 2 use xor pattern
-// 1..0 mapped category
+// if mapped {
+// if inlinedXOR {
+// 15..13 inline XOR marker
+// 12..11 unused
+// 10..3 inline XOR mask
+// } else {
+// 15..3 index into xor or mapping table
+// }
+// } else {
+// 15..14 unused
+// 13 mayNeedNorm
+// 12..11 attributes
+// 10..8 joining type
+// 7..3 category type
+// }
+// 2 use xor pattern
+// 1..0 mapped category
//
// See the definitions below for a more detailed description of the various
// bits.
diff --git a/internal/language/tables.go b/internal/language/tables.go
index a19480c..3552e1a 100644
--- a/internal/language/tables.go
+++ b/internal/language/tables.go
@@ -121,9 +121,10 @@
// lang holds an alphabetically sorted list of ISO-639 language identifiers.
// All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag.
// For 2-byte language identifiers, the two successive bytes have the following meaning:
-// - if the first letter of the 2- and 3-letter ISO codes are the same:
-// the second and third letter of the 3-letter ISO code.
-// - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3.
+// - if the first letter of the 2- and 3-letter ISO codes are the same:
+// the second and third letter of the 3-letter ISO code.
+// - otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3.
+//
// For 3-byte language identifiers the 4th byte is 0.
const lang tag.Index = "" + // Size: 5324 bytes
"---\x00aaaraai\x00aak\x00aau\x00abbkabi\x00abq\x00abr\x00abt\x00aby\x00a" +
@@ -1086,9 +1087,9 @@
// regionISO holds a list of alphabetically sorted 2-letter ISO region codes.
// Each 2-letter codes is followed by two bytes with the following meaning:
-// - [A-Z}{2}: the first letter of the 2-letter code plus these two
-// letters form the 3-letter ISO code.
-// - 0, n: index into altRegionISO3.
+// - [A-Z]{2}: the first letter of the 2-letter code plus these two
+// letters form the 3-letter ISO code.
+// - 0, n: index into altRegionISO3.
const regionISO tag.Index = "" + // Size: 1308 bytes
"AAAAACSCADNDAEREAFFGAGTGAIIAALLBAMRMANNTAOGOAQTAARRGASSMATUTAUUSAWBWAXLA" +
"AZZEBAIHBBRBBDGDBEELBFFABGGRBHHRBIDIBJENBLLMBMMUBNRNBOOLBQESBRRABSHSBTTN" +
@@ -1206,7 +1207,9 @@
// m49Index gives indexes into fromM49 based on the three most significant bits
// of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in
-// fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]]
+//
+// fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]]
+//
// for an entry where the first 7 bits match the 7 lsb of the UN.M49 code.
// The region code is stored in the 9 lsb of the indexed value.
// Size: 18 bytes, 9 elements
diff --git a/internal/number/decimal.go b/internal/number/decimal.go
index cb656db..37e0c4b 100644
--- a/internal/number/decimal.go
+++ b/internal/number/decimal.go
@@ -33,13 +33,14 @@
// may point outside a valid position in Digits.
//
// Examples:
-// Number Decimal
-// 12345 Digits: [1, 2, 3, 4, 5], Exp: 5
-// 12.345 Digits: [1, 2, 3, 4, 5], Exp: 2
-// 12000 Digits: [1, 2], Exp: 5
-// 12000.00 Digits: [1, 2], Exp: 5
-// 0.00123 Digits: [1, 2, 3], Exp: -2
-// 0 Digits: [], Exp: 0
+//
+// Number Decimal
+// 12345 Digits: [1, 2, 3, 4, 5], Exp: 5
+// 12.345 Digits: [1, 2, 3, 4, 5], Exp: 2
+// 12000 Digits: [1, 2], Exp: 5
+// 12000.00 Digits: [1, 2], Exp: 5
+// 0.00123 Digits: [1, 2, 3], Exp: -2
+// 0 Digits: [], Exp: 0
type Decimal struct {
digits
@@ -60,22 +61,23 @@
// engineering notation. Digits must have at least one digit.
//
// Examples:
-// Number Decimal
-// decimal
-// 12345 Digits: [1, 2, 3, 4, 5], Exp: 5 End: 5
-// 12.345 Digits: [1, 2, 3, 4, 5], Exp: 2 End: 5
-// 12000 Digits: [1, 2], Exp: 5 End: 5
-// 12000.00 Digits: [1, 2], Exp: 5 End: 7
-// 0.00123 Digits: [1, 2, 3], Exp: -2 End: 3
-// 0 Digits: [], Exp: 0 End: 1
-// scientific (actual exp is Exp - Comma)
-// 0e0 Digits: [0], Exp: 1, End: 1, Comma: 1
-// .0e0 Digits: [0], Exp: 0, End: 1, Comma: 0
-// 0.0e0 Digits: [0], Exp: 1, End: 2, Comma: 1
-// 1.23e4 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 1
-// .123e5 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 0
-// engineering
-// 12.3e3 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 2
+//
+// Number Decimal
+// decimal
+// 12345 Digits: [1, 2, 3, 4, 5], Exp: 5 End: 5
+// 12.345 Digits: [1, 2, 3, 4, 5], Exp: 2 End: 5
+// 12000 Digits: [1, 2], Exp: 5 End: 5
+// 12000.00 Digits: [1, 2], Exp: 5 End: 7
+// 0.00123 Digits: [1, 2, 3], Exp: -2 End: 3
+// 0 Digits: [], Exp: 0 End: 1
+// scientific (actual exp is Exp - Comma)
+// 0e0 Digits: [0], Exp: 1, End: 1, Comma: 1
+// .0e0 Digits: [0], Exp: 0, End: 1, Comma: 0
+// 0.0e0 Digits: [0], Exp: 1, End: 2, Comma: 1
+// 1.23e4 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 1
+// .123e5 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 0
+// engineering
+// 12.3e3 Digits: [1, 2, 3], Exp: 5, End: 3, Comma: 2
type Digits struct {
digits
// End indicates the end position of the number.
diff --git a/internal/testtext/codesize.go b/internal/testtext/codesize.go
index 5fc5eae..88df487 100644
--- a/internal/testtext/codesize.go
+++ b/internal/testtext/codesize.go
@@ -16,11 +16,13 @@
// CodeSize builds the given code sample and returns the binary size or en error
// if an error occurred. The code sample typically will look like this:
-// package main
-// import "golang.org/x/text/somepackage"
-// func main() {
-// somepackage.Func() // reference Func to cause it to be linked in.
-// }
+//
+// package main
+// import "golang.org/x/text/somepackage"
+// func main() {
+// somepackage.Func() // reference Func to cause it to be linked in.
+// }
+//
// See dict_test.go in the display package for an example.
func CodeSize(s string) (int, error) {
// Write the file.
diff --git a/internal/triegen/triegen.go b/internal/triegen/triegen.go
index 51d218a..de54a80 100644
--- a/internal/triegen/triegen.go
+++ b/internal/triegen/triegen.go
@@ -34,23 +34,24 @@
// triegen generates both tables and code. The code is optimized to use the
// automatically chosen data types. The following code is generated for a Trie
// or multiple Tries named "foo":
-// - type fooTrie
-// The trie type.
//
-// - func newFooTrie(x int) *fooTrie
-// Trie constructor, where x is the index of the trie passed to Gen.
+// - type fooTrie
+// The trie type.
//
-// - func (t *fooTrie) lookup(s []byte) (v uintX, sz int)
-// The lookup method, where uintX is automatically chosen.
+// - func newFooTrie(x int) *fooTrie
+// Trie constructor, where x is the index of the trie passed to Gen.
//
-// - func lookupString, lookupUnsafe and lookupStringUnsafe
-// Variants of the above.
+// - func (t *fooTrie) lookup(s []byte) (v uintX, sz int)
+// The lookup method, where uintX is automatically chosen.
//
-// - var fooValues and fooIndex and any tables generated by Compacters.
-// The core trie data.
+// - func lookupString, lookupUnsafe and lookupStringUnsafe
+// Variants of the above.
//
-// - var fooTrieHandles
-// Indexes of starter blocks in case of multiple trie roots.
+// - var fooValues and fooIndex and any tables generated by Compacters.
+// The core trie data.
+//
+// - var fooTrieHandles
+// Indexes of starter blocks in case of multiple trie roots.
//
// It is recommended that users test the generated trie by checking the returned
// value for every rune. Such exhaustive tests are possible as the number of
diff --git a/internal/utf8internal/utf8internal.go b/internal/utf8internal/utf8internal.go
index 575cea8..e5c53b1 100644
--- a/internal/utf8internal/utf8internal.go
+++ b/internal/utf8internal/utf8internal.go
@@ -74,7 +74,7 @@
// AcceptRanges is a slice of AcceptRange values. For a given byte sequence b
//
-// AcceptRanges[First[b[0]]>>AcceptShift]
+// AcceptRanges[First[b[0]]>>AcceptShift]
//
// will give the value of AcceptRange for the multi-byte UTF-8 sequence starting
// at b[0].
diff --git a/language/display/lookup.go b/language/display/lookup.go
index e6dc0e0..8830775 100644
--- a/language/display/lookup.go
+++ b/language/display/lookup.go
@@ -92,10 +92,10 @@
// offsets for a string in data. For example, consider a header that defines
// strings for the languages de, el, en, fi, and nl:
//
-// header{
-// data: "GermanGreekEnglishDutch",
-// index: []uint16{ 0, 6, 11, 18, 18, 23 },
-// }
+// header{
+// data: "GermanGreekEnglishDutch",
+// index: []uint16{0, 6, 11, 18, 18, 23},
+// }
//
// For a language with index i, the string is defined by
// data[index[i]:index[i+1]]. So the number of elements in index is always one
@@ -204,9 +204,11 @@
// for each length, which can be used in combination with binary search to get
// the index associated with a tag.
// For example, a tagIndex{
-// "arenesfrruzh", // 6 2-byte tags.
-// "barwae", // 2 3-byte tags.
-// "",
+//
+// "arenesfrruzh", // 6 2-byte tags.
+// "barwae", // 2 3-byte tags.
+// "",
+//
// }
// would mean that the 2-byte tag "fr" had an index of 3, and the 3-byte tag
// "wae" had an index of 7.
diff --git a/language/doc.go b/language/doc.go
index 8afecd5..212b77c 100644
--- a/language/doc.go
+++ b/language/doc.go
@@ -10,18 +10,17 @@
// and provides the user with the best experience
// (see https://blog.golang.org/matchlang).
//
-//
-// Matching preferred against supported languages
+// # Matching preferred against supported languages
//
// A Matcher for an application that supports English, Australian English,
// Danish, and standard Mandarin can be created as follows:
//
-// var matcher = language.NewMatcher([]language.Tag{
-// language.English, // The first language is used as fallback.
-// language.MustParse("en-AU"),
-// language.Danish,
-// language.Chinese,
-// })
+// var matcher = language.NewMatcher([]language.Tag{
+// language.English, // The first language is used as fallback.
+// language.MustParse("en-AU"),
+// language.Danish,
+// language.Chinese,
+// })
//
// This list of supported languages is typically implied by the languages for
// which there exists translations of the user interface.
@@ -30,14 +29,14 @@
// language tags.
// The MatchString finds best matches for such strings:
//
-// handler(w http.ResponseWriter, r *http.Request) {
-// lang, _ := r.Cookie("lang")
-// accept := r.Header.Get("Accept-Language")
-// tag, _ := language.MatchStrings(matcher, lang.String(), accept)
+// handler(w http.ResponseWriter, r *http.Request) {
+// lang, _ := r.Cookie("lang")
+// accept := r.Header.Get("Accept-Language")
+// tag, _ := language.MatchStrings(matcher, lang.String(), accept)
//
-// // tag should now be used for the initialization of any
-// // locale-specific service.
-// }
+// // tag should now be used for the initialization of any
+// // locale-specific service.
+// }
//
// The Matcher's Match method can be used to match Tags directly.
//
@@ -48,8 +47,7 @@
// For instance, it will know that a reader of Bokmål Danish can read Norwegian
// and will know that Cantonese ("yue") is a good match for "zh-HK".
//
-//
-// Using match results
+// # Using match results
//
// To guarantee a consistent user experience to the user it is important to
// use the same language tag for the selection of any locale-specific services.
@@ -58,9 +56,9 @@
// More subtly confusing is using the wrong sorting order or casing
// algorithm for a certain language.
//
-// All the packages in x/text that provide locale-specific services
-// (e.g. collate, cases) should be initialized with the tag that was
-// obtained at the start of an interaction with the user.
+// All the packages in x/text that provide locale-specific services
+// (e.g. collate, cases) should be initialized with the tag that was
+// obtained at the start of an interaction with the user.
//
// Note that Tag that is returned by Match and MatchString may differ from any
// of the supported languages, as it may contain carried over settings from
@@ -70,8 +68,7 @@
// Match and MatchString both return the index of the matched supported tag
// to simplify associating such data with the matched tag.
//
-//
-// Canonicalization
+// # Canonicalization
//
// If one uses the Matcher to compare languages one does not need to
// worry about canonicalization.
@@ -92,10 +89,9 @@
// equivalence relations. The CanonType type can be used to alter the
// canonicalization form.
//
-// References
+// # References
//
// BCP 47 - Tags for Identifying Languages http://tools.ietf.org/html/bcp47
-//
package language // import "golang.org/x/text/language"
// TODO: explanation on how to match languages for your own locale-specific
diff --git a/message/catalog/catalog.go b/message/catalog/catalog.go
index de595b5..96955d0 100644
--- a/message/catalog/catalog.go
+++ b/message/catalog/catalog.go
@@ -13,8 +13,7 @@
// language. The Loader interface defines a source of dictionaries. A
// translation of a format string is represented by a Message.
//
-//
-// Catalogs
+// # Catalogs
//
// A Catalog defines a programmatic interface for setting message translations.
// It maintains a set of per-language dictionaries with translations for a set
@@ -24,8 +23,7 @@
// the key. For example, a Dictionary for "en-GB" could leave out entries that
// are identical to those in a dictionary for "en".
//
-//
-// Messages
+// # Messages
//
// A Message is a format string which varies on the value of substitution
// variables. For instance, to indicate the number of results one could want "no
@@ -39,8 +37,7 @@
// to selected string. This separation of concerns allows Catalog to be used to
// store any kind of formatting strings.
//
-//
-// Selecting messages based on linguistic features of substitution arguments
+// # Selecting messages based on linguistic features of substitution arguments
//
// Messages may vary based on any linguistic features of the argument values.
// The most common one is plural form, but others exist.
@@ -48,10 +45,10 @@
// Selection messages are provided in packages that provide support for a
// specific linguistic feature. The following snippet uses plural.Selectf:
//
-// catalog.Set(language.English, "You are %d minute(s) late.",
-// plural.Selectf(1, "",
-// plural.One, "You are 1 minute late.",
-// plural.Other, "You are %d minutes late."))
+// catalog.Set(language.English, "You are %d minute(s) late.",
+// plural.Selectf(1, "",
+// plural.One, "You are 1 minute late.",
+// plural.Other, "You are %d minutes late."))
//
// In this example, a message is stored in the Catalog where one of two messages
// is selected based on the first argument, a number. The first message is
@@ -64,47 +61,46 @@
// Selects can be nested. This allows selecting sentences based on features of
// multiple arguments or multiple linguistic properties of a single argument.
//
-//
-// String interpolation
+// # String interpolation
//
// There is often a lot of commonality between the possible variants of a
// message. For instance, in the example above the word "minute" varies based on
// the plural catogory of the argument, but the rest of the sentence is
// identical. Using interpolation the above message can be rewritten as:
//
-// catalog.Set(language.English, "You are %d minute(s) late.",
-// catalog.Var("minutes",
-// plural.Selectf(1, "", plural.One, "minute", plural.Other, "minutes")),
-// catalog.String("You are %[1]d ${minutes} late."))
+// catalog.Set(language.English, "You are %d minute(s) late.",
+// catalog.Var("minutes",
+// plural.Selectf(1, "", plural.One, "minute", plural.Other, "minutes")),
+// catalog.String("You are %[1]d ${minutes} late."))
//
// Var is defined to return the variable name if the message does not yield a
// match. This allows us to further simplify this snippet to
//
-// catalog.Set(language.English, "You are %d minute(s) late.",
-// catalog.Var("minutes", plural.Selectf(1, "", plural.One, "minute")),
-// catalog.String("You are %d ${minutes} late."))
+// catalog.Set(language.English, "You are %d minute(s) late.",
+// catalog.Var("minutes", plural.Selectf(1, "", plural.One, "minute")),
+// catalog.String("You are %d ${minutes} late."))
//
// Overall this is still only a minor improvement, but things can get a lot more
// unwieldy if more than one linguistic feature is used to determine a message
// variant. Consider the following example:
//
-// // argument 1: list of hosts, argument 2: list of guests
-// catalog.Set(language.English, "%[1]v invite(s) %[2]v to their party.",
-// catalog.Var("their",
-// plural.Selectf(1, ""
-// plural.One, gender.Select(1, "female", "her", "other", "his"))),
-// catalog.Var("invites", plural.Selectf(1, "", plural.One, "invite"))
-// catalog.String("%[1]v ${invites} %[2]v to ${their} party.")),
+// // argument 1: list of hosts, argument 2: list of guests
+// catalog.Set(language.English, "%[1]v invite(s) %[2]v to their party.",
+// catalog.Var("their",
+// plural.Selectf(1, ""
+// plural.One, gender.Select(1, "female", "her", "other", "his"))),
+// catalog.Var("invites", plural.Selectf(1, "", plural.One, "invite"))
+// catalog.String("%[1]v ${invites} %[2]v to ${their} party.")),
//
// Without variable substitution, this would have to be written as
//
-// // argument 1: list of hosts, argument 2: list of guests
-// catalog.Set(language.English, "%[1]v invite(s) %[2]v to their party.",
-// plural.Selectf(1, "",
-// plural.One, gender.Select(1,
-// "female", "%[1]v invites %[2]v to her party."
-// "other", "%[1]v invites %[2]v to his party."),
-// plural.Other, "%[1]v invites %[2]v to their party.")
+// // argument 1: list of hosts, argument 2: list of guests
+// catalog.Set(language.English, "%[1]v invite(s) %[2]v to their party.",
+// plural.Selectf(1, "",
+// plural.One, gender.Select(1,
+// "female", "%[1]v invites %[2]v to her party."
+// "other", "%[1]v invites %[2]v to his party."),
+// plural.Other, "%[1]v invites %[2]v to their party."))
//
// Not necessarily shorter, but using variables there is less duplication and
// the messages are more maintenance friendly. Moreover, languages may have up
@@ -113,33 +109,32 @@
// Different messages using the same inflections can reuse variables by moving
// them to macros. Using macros we can rewrite the message as:
//
-// // argument 1: list of hosts, argument 2: list of guests
-// catalog.SetString(language.English, "%[1]v invite(s) %[2]v to their party.",
-// "%[1]v ${invites(1)} %[2]v to ${their(1)} party.")
+// // argument 1: list of hosts, argument 2: list of guests
+// catalog.SetString(language.English, "%[1]v invite(s) %[2]v to their party.",
+// "%[1]v ${invites(1)} %[2]v to ${their(1)} party.")
//
// Where the following macros were defined separately.
//
-// catalog.SetMacro(language.English, "invites", plural.Selectf(1, "",
-// plural.One, "invite"))
-// catalog.SetMacro(language.English, "their", plural.Selectf(1, "",
-// plural.One, gender.Select(1, "female", "her", "other", "his"))),
+// catalog.SetMacro(language.English, "invites", plural.Selectf(1, "",
+// plural.One, "invite"))
+// catalog.SetMacro(language.English, "their", plural.Selectf(1, "",
+// plural.One, gender.Select(1, "female", "her", "other", "his"))),
//
// Placeholders use parentheses and the arguments to invoke a macro.
//
-//
-// Looking up messages
+// # Looking up messages
//
// Message lookup using Catalogs is typically only done by specialized packages
// and is not something the user should be concerned with. For instance, to
// express the tardiness of a user using the related message we defined earlier,
// the user may use the package message like so:
//
-// p := message.NewPrinter(language.English)
-// p.Printf("You are %d minute(s) late.", 5)
+// p := message.NewPrinter(language.English)
+// p.Printf("You are %d minute(s) late.", 5)
//
// Which would print:
-// You are 5 minutes late.
//
+// You are 5 minutes late.
//
// This package is UNDER CONSTRUCTION and its API may change.
package catalog // import "golang.org/x/text/message/catalog"
diff --git a/message/doc.go b/message/doc.go
index 72e8fde..4bf7bdc 100644
--- a/message/doc.go
+++ b/message/doc.go
@@ -5,22 +5,21 @@
// Package message implements formatted I/O for localized strings with functions
// analogous to the fmt's print functions. It is a drop-in replacement for fmt.
//
-//
-// Localized Formatting
+// # Localized Formatting
//
// A format string can be localized by replacing any of the print functions of
// fmt with an equivalent call to a Printer.
//
-// p := message.NewPrinter(message.MatchLanguage("en"))
-// p.Println(123456.78) // Prints 123,456.78
+// p := message.NewPrinter(message.MatchLanguage("en"))
+// p.Println(123456.78) // Prints 123,456.78
//
-// p.Printf("%d ducks in a row", 4331) // Prints 4,331 ducks in a row
+// p.Printf("%d ducks in a row", 4331) // Prints 4,331 ducks in a row
//
-// p := message.NewPrinter(message.MatchLanguage("nl"))
-// p.Printf("Hoogte: %.1f meter", 1244.9) // Prints Hoogte: 1,244.9 meter
+// p := message.NewPrinter(message.MatchLanguage("nl"))
+// p.Printf("Hoogte: %.1f meter", 1244.9) // Prints Hoogte: 1,244.9 meter
//
-// p := message.NewPrinter(message.MatchLanguage("bn"))
-// p.Println(123456.78) // Prints ১,২৩,৪৫৬.৭৮
+// p := message.NewPrinter(message.MatchLanguage("bn"))
+// p.Println(123456.78) // Prints ১,২৩,৪৫৬.৭৮
//
// Printer currently supports numbers and specialized types for which packages
// exist in x/text. Other builtin types such as time.Time and slices are
@@ -35,8 +34,7 @@
//
// See package fmt for more options.
//
-//
-// Translation
+// # Translation
//
// The format strings that are passed to Printf, Sprintf, Fprintf, or Errorf
// are used as keys to look up translations for the specified languages.
@@ -44,34 +42,36 @@
//
// One can use arbitrary keys to distinguish between otherwise ambiguous
// strings:
-// p := message.NewPrinter(language.English)
-// p.Printf("archive(noun)") // Prints "archive"
-// p.Printf("archive(verb)") // Prints "archive"
//
-// p := message.NewPrinter(language.German)
-// p.Printf("archive(noun)") // Prints "Archiv"
-// p.Printf("archive(verb)") // Prints "archivieren"
+// p := message.NewPrinter(language.English)
+// p.Printf("archive(noun)") // Prints "archive"
+// p.Printf("archive(verb)") // Prints "archive"
+//
+// p := message.NewPrinter(language.German)
+// p.Printf("archive(noun)") // Prints "Archiv"
+// p.Printf("archive(verb)") // Prints "archivieren"
//
// To retain the fallback functionality, use Key:
-// p.Printf(message.Key("archive(noun)", "archive"))
-// p.Printf(message.Key("archive(verb)", "archive"))
//
+// p.Printf(message.Key("archive(noun)", "archive"))
+// p.Printf(message.Key("archive(verb)", "archive"))
//
-// Translation Pipeline
+// # Translation Pipeline
//
// Format strings that contain text need to be translated to support different
// locales. The first step is to extract strings that need to be translated.
//
// 1. Install gotext
-// go get -u golang.org/x/text/cmd/gotext
-// gotext -help
+//
+// go get -u golang.org/x/text/cmd/gotext
+// gotext -help
//
// 2. Mark strings in your source to be translated by using message.Printer,
// instead of the functions of the fmt package.
//
// 3. Extract the strings from your source
//
-// gotext extract
+// gotext extract
//
// The output will be written to the textdata directory.
//
@@ -89,13 +89,11 @@
// see also package golang.org/x/text/message/catalog can be used to implement
// either dynamic or static loading of messages.
//
-//
-// Plural and Gender Forms
+// # Plural and Gender Forms
//
// Translated messages can vary based on the plural and gender forms of
// substitution values. In general, it is up to the translators to provide
// alternative translations for such forms. See the packages in
// golang.org/x/text/feature and golang.org/x/text/message/catalog for more
// information.
-//
package message
diff --git a/number/doc.go b/number/doc.go
index 2ad8d43..8766230 100644
--- a/number/doc.go
+++ b/number/doc.go
@@ -9,19 +9,18 @@
// builtin Go types and anything that implements the Convert interface
// (currently internal).
//
-// p := message.NewPrinter(language.English)
+// p := message.NewPrinter(language.English)
//
-// p.Printf("%v bottles of beer on the wall.", number.Decimal(1234))
-// // Prints: 1,234 bottles of beer on the wall.
+// p.Printf("%v bottles of beer on the wall.", number.Decimal(1234))
+// // Prints: 1,234 bottles of beer on the wall.
//
-// p.Printf("%v of gophers lose too much fur", number.Percent(0.12))
-// // Prints: 12% of gophers lose too much fur.
+// p.Printf("%v of gophers lose too much fur", number.Percent(0.12))
+// // Prints: 12% of gophers lose too much fur.
//
-// p := message.NewPrinter(language.Dutch)
+// p := message.NewPrinter(language.Dutch)
//
-// p.Printf("There are %v bikes per household.", number.Decimal(1.2))
-// // Prints: Er zijn 1,2 fietsen per huishouden.
-//
+// p.Printf("There are %v bikes per household.", number.Decimal(1.2))
+// // Prints: Er zijn 1,2 fietsen per huishouden.
//
// The width and scale specified in the formatting directives override the
// configuration of the formatter.
diff --git a/unicode/bidi/core.go b/unicode/bidi/core.go
index fde188a..9d2ae54 100644
--- a/unicode/bidi/core.go
+++ b/unicode/bidi/core.go
@@ -193,14 +193,14 @@
//
// At the end of this function:
//
-// - The member variable matchingPDI is set to point to the index of the
-// matching PDI character for each isolate initiator character. If there is
-// no matching PDI, it is set to the length of the input text. For other
-// characters, it is set to -1.
-// - The member variable matchingIsolateInitiator is set to point to the
-// index of the matching isolate initiator character for each PDI character.
-// If there is no matching isolate initiator, or the character is not a PDI,
-// it is set to -1.
+// - The member variable matchingPDI is set to point to the index of the
+// matching PDI character for each isolate initiator character. If there is
+// no matching PDI, it is set to the length of the input text. For other
+// characters, it is set to -1.
+// - The member variable matchingIsolateInitiator is set to point to the
+// index of the matching isolate initiator character for each PDI character.
+// If there is no matching isolate initiator, or the character is not a PDI,
+// it is set to -1.
func (p *paragraph) determineMatchingIsolates() {
p.matchingPDI = make([]int, p.Len())
p.matchingIsolateInitiator = make([]int, p.Len())
@@ -435,7 +435,7 @@
}
// Rule X10, second bullet: Determine the start-of-sequence (sos) and end-of-sequence (eos) types,
-// either L or R, for each isolating run sequence.
+// either L or R, for each isolating run sequence.
func (p *paragraph) isolatingRunSequence(indexes []int) *isolatingRunSequence {
length := len(indexes)
types := make([]Class, length)
@@ -905,7 +905,7 @@
// Lines are concatenated from left to right. So for example, the fifth
// character from the left on the third line is
//
-// getReordering(linebreaks)[linebreaks[1] + 4]
+// getReordering(linebreaks)[linebreaks[1] + 4]
//
// (linebreaks[1] is the position after the last character of the second
// line, which is also the index of the first character on the third line,
diff --git a/unicode/cldr/collate.go b/unicode/cldr/collate.go
index 27c5bac..056fe7f 100644
--- a/unicode/cldr/collate.go
+++ b/unicode/cldr/collate.go
@@ -98,9 +98,13 @@
}
// parseSpecialAnchor parses the anchor syntax which is either of the form
-// ['before' <level>] <anchor>
+//
+// ['before' <level>] <anchor>
+//
// or
-// [<label>]
+//
+// [<label>]
+//
// The starting should already be consumed.
func parseSpecialAnchor(p RuleProcessor, s string) (tail string, err error) {
i := strings.IndexByte(s, ']')
diff --git a/unicode/norm/forminfo.go b/unicode/norm/forminfo.go
index 526c703..d69ccb4 100644
--- a/unicode/norm/forminfo.go
+++ b/unicode/norm/forminfo.go
@@ -110,10 +110,11 @@
}
// We pack quick check data in 4 bits:
-// 5: Combines forward (0 == false, 1 == true)
-// 4..3: NFC_QC Yes(00), No (10), or Maybe (11)
-// 2: NFD_QC Yes (0) or No (1). No also means there is a decomposition.
-// 1..0: Number of trailing non-starters.
+//
+// 5: Combines forward (0 == false, 1 == true)
+// 4..3: NFC_QC Yes(00), No (10), or Maybe (11)
+// 2: NFD_QC Yes (0) or No (1). No also means there is a decomposition.
+// 1..0: Number of trailing non-starters.
//
// When all 4 bits are zero, the character is inert, meaning it is never
// influenced by normalization.
diff --git a/unicode/norm/maketables.go b/unicode/norm/maketables.go
index 0d24d21..dd05b6f 100644
--- a/unicode/norm/maketables.go
+++ b/unicode/norm/maketables.go
@@ -132,8 +132,10 @@
}
// In UnicodeData.txt, some ranges are marked like this:
+//
// 3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
// 4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
+//
// parseCharacter keeps a state variable indicating the weirdness.
type State int
diff --git a/unicode/norm/normalize.go b/unicode/norm/normalize.go
index 95efcf2..4747ad0 100644
--- a/unicode/norm/normalize.go
+++ b/unicode/norm/normalize.go
@@ -18,16 +18,17 @@
// A Form denotes a canonical representation of Unicode code points.
// The Unicode-defined normalization and equivalence forms are:
//
-// NFC Unicode Normalization Form C
-// NFD Unicode Normalization Form D
-// NFKC Unicode Normalization Form KC
-// NFKD Unicode Normalization Form KD
+// NFC Unicode Normalization Form C
+// NFD Unicode Normalization Form D
+// NFKC Unicode Normalization Form KC
+// NFKD Unicode Normalization Form KD
//
// For a Form f, this documentation uses the notation f(x) to mean
// the bytes or string x converted to the given form.
// A position n in x is called a boundary if conversion to the form can
// proceed independently on both sides:
-// f(x) == append(f(x[0:n]), f(x[n:])...)
+//
+// f(x) == append(f(x[0:n]), f(x[n:])...)
//
// References: https://unicode.org/reports/tr15/ and
// https://unicode.org/notes/tn5/.
diff --git a/width/tables10.0.0.go b/width/tables10.0.0.go
index 186b1d4..cd9d91c 100644
--- a/width/tables10.0.0.go
+++ b/width/tables10.0.0.go
@@ -1146,21 +1146,31 @@
}
// inverseData contains 4-byte entries of the following format:
-// <length> <modified UTF-8-encoded rune> <0 padding>
+//
+// <length> <modified UTF-8-encoded rune> <0 padding>
+//
// The last byte of the UTF-8-encoded rune is xor-ed with the last byte of the
// UTF-8 encoding of the original rune. Mappings often have the following
// pattern:
-// A -> A (U+FF21 -> U+0041)
-// B -> B (U+FF22 -> U+0042)
-// ...
+//
+// A -> A (U+FF21 -> U+0041)
+// B -> B (U+FF22 -> U+0042)
+// ...
+//
// By xor-ing the last byte the same entry can be shared by many mappings. This
// reduces the total number of distinct entries by about two thirds.
// The resulting entry for the aforementioned mappings is
-// { 0x01, 0xE0, 0x00, 0x00 }
+//
+// { 0x01, 0xE0, 0x00, 0x00 }
+//
// Using this entry to map U+FF21 (UTF-8 [EF BC A1]), we get
-// E0 ^ A1 = 41.
+//
+// E0 ^ A1 = 41.
+//
// Similarly, for U+FF22 (UTF-8 [EF BC A2]), we get
-// E0 ^ A2 = 42.
+//
+// E0 ^ A2 = 42.
+//
// Note that because of the xor-ing, the byte sequence stored in the entry is
// not valid UTF-8.
var inverseData = [150][4]byte{
diff --git a/width/tables11.0.0.go b/width/tables11.0.0.go
index 990f762..327eaef 100644
--- a/width/tables11.0.0.go
+++ b/width/tables11.0.0.go
@@ -1158,21 +1158,31 @@
}
// inverseData contains 4-byte entries of the following format:
-// <length> <modified UTF-8-encoded rune> <0 padding>
+//
+// <length> <modified UTF-8-encoded rune> <0 padding>
+//
// The last byte of the UTF-8-encoded rune is xor-ed with the last byte of the
// UTF-8 encoding of the original rune. Mappings often have the following
// pattern:
-// A -> A (U+FF21 -> U+0041)
-// B -> B (U+FF22 -> U+0042)
-// ...
+//
+// A -> A (U+FF21 -> U+0041)
+// B -> B (U+FF22 -> U+0042)
+// ...
+//
// By xor-ing the last byte the same entry can be shared by many mappings. This
// reduces the total number of distinct entries by about two thirds.
// The resulting entry for the aforementioned mappings is
-// { 0x01, 0xE0, 0x00, 0x00 }
+//
+// { 0x01, 0xE0, 0x00, 0x00 }
+//
// Using this entry to map U+FF21 (UTF-8 [EF BC A1]), we get
-// E0 ^ A1 = 41.
+//
+// E0 ^ A1 = 41.
+//
// Similarly, for U+FF22 (UTF-8 [EF BC A2]), we get
-// E0 ^ A2 = 42.
+//
+// E0 ^ A2 = 42.
+//
// Note that because of the xor-ing, the byte sequence stored in the entry is
// not valid UTF-8.
var inverseData = [150][4]byte{
diff --git a/width/tables12.0.0.go b/width/tables12.0.0.go
index 8529629..5c14ade 100644
--- a/width/tables12.0.0.go
+++ b/width/tables12.0.0.go
@@ -1178,21 +1178,31 @@
}
// inverseData contains 4-byte entries of the following format:
-// <length> <modified UTF-8-encoded rune> <0 padding>
+//
+// <length> <modified UTF-8-encoded rune> <0 padding>
+//
// The last byte of the UTF-8-encoded rune is xor-ed with the last byte of the
// UTF-8 encoding of the original rune. Mappings often have the following
// pattern:
-// A -> A (U+FF21 -> U+0041)
-// B -> B (U+FF22 -> U+0042)
-// ...
+//
+// A -> A (U+FF21 -> U+0041)
+// B -> B (U+FF22 -> U+0042)
+// ...
+//
// By xor-ing the last byte the same entry can be shared by many mappings. This
// reduces the total number of distinct entries by about two thirds.
// The resulting entry for the aforementioned mappings is
-// { 0x01, 0xE0, 0x00, 0x00 }
+//
+// { 0x01, 0xE0, 0x00, 0x00 }
+//
// Using this entry to map U+FF21 (UTF-8 [EF BC A1]), we get
-// E0 ^ A1 = 41.
+//
+// E0 ^ A1 = 41.
+//
// Similarly, for U+FF22 (UTF-8 [EF BC A2]), we get
-// E0 ^ A2 = 42.
+//
+// E0 ^ A2 = 42.
+//
// Note that because of the xor-ing, the byte sequence stored in the entry is
// not valid UTF-8.
var inverseData = [150][4]byte{
diff --git a/width/tables13.0.0.go b/width/tables13.0.0.go
index bac3f1a..ab258e3 100644
--- a/width/tables13.0.0.go
+++ b/width/tables13.0.0.go
@@ -1179,21 +1179,31 @@
}
// inverseData contains 4-byte entries of the following format:
-// <length> <modified UTF-8-encoded rune> <0 padding>
+//
+// <length> <modified UTF-8-encoded rune> <0 padding>
+//
// The last byte of the UTF-8-encoded rune is xor-ed with the last byte of the
// UTF-8 encoding of the original rune. Mappings often have the following
// pattern:
-// A -> A (U+FF21 -> U+0041)
-// B -> B (U+FF22 -> U+0042)
-// ...
+//
+// A -> A (U+FF21 -> U+0041)
+// B -> B (U+FF22 -> U+0042)
+// ...
+//
// By xor-ing the last byte the same entry can be shared by many mappings. This
// reduces the total number of distinct entries by about two thirds.
// The resulting entry for the aforementioned mappings is
-// { 0x01, 0xE0, 0x00, 0x00 }
+//
+// { 0x01, 0xE0, 0x00, 0x00 }
+//
// Using this entry to map U+FF21 (UTF-8 [EF BC A1]), we get
-// E0 ^ A1 = 41.
+//
+// E0 ^ A1 = 41.
+//
// Similarly, for U+FF22 (UTF-8 [EF BC A2]), we get
-// E0 ^ A2 = 42.
+//
+// E0 ^ A2 = 42.
+//
// Note that because of the xor-ing, the byte sequence stored in the entry is
// not valid UTF-8.
var inverseData = [150][4]byte{
diff --git a/width/tables9.0.0.go b/width/tables9.0.0.go
index b3db84f..6781f3d 100644
--- a/width/tables9.0.0.go
+++ b/width/tables9.0.0.go
@@ -1114,21 +1114,31 @@
}
// inverseData contains 4-byte entries of the following format:
-// <length> <modified UTF-8-encoded rune> <0 padding>
+//
+// <length> <modified UTF-8-encoded rune> <0 padding>
+//
// The last byte of the UTF-8-encoded rune is xor-ed with the last byte of the
// UTF-8 encoding of the original rune. Mappings often have the following
// pattern:
-// A -> A (U+FF21 -> U+0041)
-// B -> B (U+FF22 -> U+0042)
-// ...
+//
+// A -> A (U+FF21 -> U+0041)
+// B -> B (U+FF22 -> U+0042)
+// ...
+//
// By xor-ing the last byte the same entry can be shared by many mappings. This
// reduces the total number of distinct entries by about two thirds.
// The resulting entry for the aforementioned mappings is
-// { 0x01, 0xE0, 0x00, 0x00 }
+//
+// { 0x01, 0xE0, 0x00, 0x00 }
+//
// Using this entry to map U+FF21 (UTF-8 [EF BC A1]), we get
-// E0 ^ A1 = 41.
+//
+// E0 ^ A1 = 41.
+//
// Similarly, for U+FF22 (UTF-8 [EF BC A2]), we get
-// E0 ^ A2 = 42.
+//
+// E0 ^ A2 = 42.
+//
// Note that because of the xor-ing, the byte sequence stored in the entry is
// not valid UTF-8.
var inverseData = [150][4]byte{
To view, visit change 399603. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ie45b11898b01babdfc9f23fd1fd8aefd367b98c6
Reviewed-on: https://go-review.googlesource.com/c/playground/+/399601
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M play.go
M sandbox/metrics.go
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/play.go b/play.go
index e160220..d07c22f 100644
--- a/play.go
+++ b/play.go
@@ -30,10 +30,10 @@
// occurring at the same time as the preceding event.
//
// A playback header has this structure:
-// 4 bytes: "\x00\x00PB", a magic header
-// 8 bytes: big-endian int64, unix time in nanoseconds
-// 4 bytes: big-endian int32, length of the next write
//
+// 4 bytes: "\x00\x00PB", a magic header
+// 8 bytes: big-endian int64, unix time in nanoseconds
+// 4 bytes: big-endian int32, length of the next write
type Recorder struct {
stdout, stderr recorderWriter
}
diff --git a/sandbox/metrics.go b/sandbox/metrics.go
index 7fb213e..849bcce 100644
--- a/sandbox/metrics.go
+++ b/sandbox/metrics.go
@@ -55,8 +55,8 @@
)
// Customizations of ochttp views. Views are updated as follows:
-// * The views are prefixed with go-playground-sandbox.
-// * ochttp.KeyServerRoute is added as a tag to label metrics per-route.
+// - The views are prefixed with go-playground-sandbox.
+// - ochttp.KeyServerRoute is added as a tag to label metrics per-route.
var (
ServerRequestCountView = &view.View{
Name: "go-playground-sandbox/http/server/request_count",
To view, visit change 399601. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ib5c83cdade85433f805d1b9f3203f319932a8939
Reviewed-on: https://go-review.googlesource.com/c/time/+/399604
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M rate/rate.go
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/rate/rate.go b/rate/rate.go
index b0b982e..e77ade3 100644
--- a/rate/rate.go
+++ b/rate/rate.go
@@ -196,13 +196,15 @@
// The Limiter takes this Reservation into account when allowing future events.
// The returned Reservation’s OK() method returns false if n exceeds the Limiter's burst size.
// Usage example:
-// r := lim.ReserveN(time.Now(), 1)
-// if !r.OK() {
-// // Not allowed to act! Did you remember to set lim.burst to be > 0 ?
-// return
-// }
-// time.Sleep(r.Delay())
-// Act()
+//
+// r := lim.ReserveN(time.Now(), 1)
+// if !r.OK() {
+// // Not allowed to act! Did you remember to set lim.burst to be > 0 ?
+// return
+// }
+// time.Sleep(r.Delay())
+// Act()
+//
// Use this method if you wish to wait and slow down in accordance with the rate limit without dropping events.
// If you need to respect a deadline or cancel the delay, use Wait instead.
// To drop or skip events exceeding rate limit, use Allow instead.
To view, visit change 399604. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: I257fdc6811a1156714d7c7934f6256f07a460b9d
Reviewed-on: https://go-review.googlesource.com/c/review/+/399618
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M git-codereview/doc.go
M git-codereview/go19_test.go
2 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/git-codereview/doc.go b/git-codereview/doc.go
index a74d7d4..75082d4 100644
--- a/git-codereview/doc.go
+++ b/git-codereview/doc.go
@@ -53,7 +53,7 @@
sync = codereview sync
sync-branch = codereview sync-branch
-Single-Commit Work Branches
+# Single-Commit Work Branches
For simple, unrelated changes, the typical usage of the git-codereview tool
is to place each pending change in its own Git branch.
@@ -69,7 +69,7 @@
The “git codereview mail” and “git codereview submit” commands
implicitly operate on the lone pending change.
-Multiple-Commit Work Branches
+# Multiple-Commit Work Branches
Of course, it is not always feasible to put each pending change in a separate branch.
A sequence of changes that build on one another is more easily
@@ -98,7 +98,7 @@
Instead it is necessary to run “git codereview sync” explicitly
(when ready) after “git codereview submit”.
-Reusing Work Branches
+# Reusing Work Branches
Although one common practice is to create a new branch for each pending change,
running “git codereview submit” (and possibly “git codereview sync”)
@@ -107,7 +107,7 @@
(“git change work”) and then do all work in that branch,
possibly in the multiple-commit mode, never changing between branches.
-Commands
+# Commands
All commands accept these global flags:
@@ -118,7 +118,7 @@
These are omitted from the per-command descriptions below.
-Branchpoint
+# Branchpoint
The branchpoint command prints the commit hash of the most recent commit
on the current branch that is shared with the Gerrit server.
@@ -130,7 +130,7 @@
“git diff $(git codereview branchpoint)” or
“git log $(git codereview branchpoint)..HEAD”.
-Change
+# Change
The change command creates and moves between Git branches and maintains the
pending changes on work branches.
@@ -167,7 +167,7 @@
treated a GitHub pull request number, and the change command downloads the latest
version of that pull request. In this case, the /P suffix is disallowed.
-Gofmt
+# Gofmt
The gofmt command applies the gofmt program to all files modified in the
current work branch, both in the staging area (index) and the working tree
@@ -180,13 +180,13 @@
place. That is, files in the staging area are reformatted in the staging area,
and files in the working tree are reformatted in the working tree.
-Help
+# Help
The help command displays basic usage instructions.
git codereview help
-Hooks
+# Hooks
The hooks command installs the Git hooks to enforce code review conventions.
@@ -205,7 +205,7 @@
This hook installation is also done at startup by all other git codereview
commands, except “git codereview help”.
-Hook-Invoke
+# Hook-Invoke
The hook-invoke command is an internal command that invokes the named Git hook.
@@ -213,7 +213,7 @@
It is run by the shell scripts installed by the “git codereview hooks” command.
The mail command starts the code review process for the pending change.
@@ -266,7 +266,7 @@
commit that was most recently mailed, so running “git diff <branchname>.mailed”
shows diffs between what is on the Gerrit server and the current directory.
-Pending
+# Pending
The pending command prints to standard output the status of all pending changes
and staged, unstaged, and untracked files in the local repository.
@@ -284,7 +284,7 @@
Useful aliases include “git p” for “git pending” and “git pl” for “git pending -l”
(notably faster but without Gerrit information).
-Rebase-work
+# Rebase-work
The rebase-work command runs git rebase in interactive mode over pending changes.
@@ -298,7 +298,7 @@
In multiple-commit workflows, rebase-work is used so often that it can be helpful
to alias it to “git rw”.
-Reword
+# Reword
The reword command edits pending commit messages.
@@ -320,7 +320,7 @@
branch, but it can also be useful in single-commit work branches to allow
editing a commit message without committing staged changes at the same time.
-Submit
+# Submit
The submit command pushes the pending change to the Gerrit server and tells
Gerrit to submit it to the upstream branch.
@@ -347,7 +347,7 @@
After a successful sync, the branch can be used to prepare a new change.
-Sync
+# Sync
The sync command updates the local repository.
@@ -356,7 +356,7 @@
It fetches commits from the remote repository and merges them from the
upstream branch to the current branch, rebasing any pending changes.
-Sync-branch
+# Sync-branch
The sync-branch command merges changes from the parent branch into
the current branch.
@@ -388,7 +388,7 @@
be configured to mail changes to the parent branch instead of the
dev branch.
-Configuration
+# Configuration
If a file named codereview.cfg is present in the repository root,
git-codereview will use it for configuration. It should contain lines
diff --git a/git-codereview/go19_test.go b/git-codereview/go19_test.go
index c2dc46e..999769d 100644
--- a/git-codereview/go19_test.go
+++ b/git-codereview/go19_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.9
// +build go1.9
package main
To view, visit change 399618. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ie063c2fd890641b551c0f304fee5fa19121f1b38
Reviewed-on: https://go-review.googlesource.com/c/build/+/399555
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Dmitri Shuralyov <dmit...@golang.org>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M cmd/buildlet/buildlet.go
M cmd/cl/cl.go
M cmd/coordinator/buildstatus.go
M cmd/coordinator/coordinator.go
M cmd/coordinator/internal/legacydash/ui.go
M cmd/coordinator/remote.go
M cmd/coordinator/status.go
M cmd/debugnewvm/debugnewvm.go
M cmd/fetchlogs/fetchlogs.go
M cmd/gomote/gomote.go
M cmd/gopherbot/gopherbot.go
M cmd/makemac/makemac.go
M cmd/racebuild/racebuild.go
M cmd/release/upload.go
M cmd/retrybuilds/retrybuilds.go
M cmd/updatestd/updatestd.go
M cmd/xb/xb.go
M devapp/server.go
M devapp/title.go
M env/corellium/ios/files/arwrap.go
M env/corellium/ios/files/clangwrap.go
M internal/coordinator/pool/reverse.go
M internal/gophers/gophers.go
M internal/relui/content.go
M internal/relui/web_test.go
M internal/spanlog/spanlog.go
M internal/task/dlcl.go
M kubernetes/api/quantity.go
M kubernetes/api/types.go
M maintner/gerrit.go
M maintner/git.go
M maintner/github.go
M maintner/internal/robustio/robustio.go
M maintner/maintner.go
M maintner/maintpb/maintner.pb.go
M perf/app/parse.go
M perf/app/trend.go
M perfdata/client.go
M perfdata/cmd/reindex/reindex.go
M perfdata/db/db.go
M perfdata/localperfdata/app.go
41 files changed, 283 insertions(+), 234 deletions(-)
diff --git a/cmd/buildlet/buildlet.go b/cmd/buildlet/buildlet.go
index 5609a4b..e462a13 100644
--- a/cmd/buildlet/buildlet.go
+++ b/cmd/buildlet/buildlet.go
@@ -67,20 +67,21 @@
// package's client API (via the Status method).
//
// Notable versions:
-// 3: switched to revdial protocol
-// 5: reverse dialing uses timeouts+tcp keepalives, pargzip fix
-// 7: version bumps while debugging revdial hang (Issue 12816)
-// 8: mac screensaver disabled
-// 11: move from self-signed cert to LetsEncrypt (Issue 16442)
-// 15: ssh support
-// 16: make macstadium builders always haltEntireOS
-// 17: make macstadium halts use sudo
-// 18: set TMPDIR and GOCACHE
-// 21: GO_BUILDER_SET_GOPROXY=coordinator support
-// 22: TrimSpace the reverse buildlet's gobuildkey contents
-// 23: revdial v2
-// 24: removeAllIncludingReadonly
-// 25: use removeAllIncludingReadonly for all work area cleanup
+//
+// 3: switched to revdial protocol
+// 5: reverse dialing uses timeouts+tcp keepalives, pargzip fix
+// 7: version bumps while debugging revdial hang (Issue 12816)
+// 8: mac screensaver disabled
+// 11: move from self-signed cert to LetsEncrypt (Issue 16442)
+// 15: ssh support
+// 16: make macstadium builders always haltEntireOS
+// 17: make macstadium halts use sudo
+// 18: set TMPDIR and GOCACHE
+// 21: GO_BUILDER_SET_GOPROXY=coordinator support
+// 22: TrimSpace the reverse buildlet's gobuildkey contents
+// 23: revdial v2
+// 24: removeAllIncludingReadonly
+// 25: use removeAllIncludingReadonly for all work area cleanup
const buildletVersion = 25
func defaultListenAddr() string {
diff --git a/cmd/cl/cl.go b/cmd/cl/cl.go
index d03331e..3a764f2 100644
--- a/cmd/cl/cl.go
+++ b/cmd/cl/cl.go
@@ -34,13 +34,13 @@
and no subsequent upload of a new patch set.
If the -closed flag is specified, CL adds closed CLs to the output.
-By default, CL omits CLs containing ``DO NOT REVIEW'' in the
+By default, CL omits CLs containing “DO NOT REVIEW” in the
latest patch's commit message.
If the -dnr flag is specified, CL includes those CLs in its output.
If the -r flag is specified, CL shows only CLs that need review,
not those waiting for the author. In this mode, the
-redundant ``waiting for reviewer'' asterisk is elided.
+redundant “waiting for reviewer” asterisk is elided.
If the -url flag is specified, CL replaces "CL 1234" at the beginning
of each output line with a full URL, "https://golang.org/cl/1234".
diff --git a/cmd/coordinator/buildstatus.go b/cmd/coordinator/buildstatus.go
index 5638a09..d7883e9 100644
--- a/cmd/coordinator/buildstatus.go
+++ b/cmd/coordinator/buildstatus.go
@@ -1169,9 +1169,8 @@
// The logic of the go tool for ignoring directories is documented at
// https://golang.org/cmd/go/#hdr-Package_lists_and_patterns:
//
-// Directory and file names that begin with "." or "_" are ignored
-// by the go tool, as are directories named "testdata".
-//
+// Directory and file names that begin with "." or "_" are ignored
+// by the go tool, as are directories named "testdata".
func ignoredByGoTool(importPath string) bool {
for _, el := range strings.Split(importPath, "/") {
if strings.HasPrefix(el, ".") || strings.HasPrefix(el, "_") || el == "testdata" {
diff --git a/cmd/coordinator/coordinator.go b/cmd/coordinator/coordinator.go
index 572d499..25b71db 100644
--- a/cmd/coordinator/coordinator.go
+++ b/cmd/coordinator/coordinator.go
@@ -150,8 +150,8 @@
// httpRouter is the coordinator's handler, routing traffic to one of
// two locations:
-// 1) a buildlet, from gomote clients (if X-Buildlet-Proxy is set)
-// 2) traffic to the coordinator itself (the default)
+// 1. a buildlet, from gomote clients (if X-Buildlet-Proxy is set)
+// 2. traffic to the coordinator itself (the default)
func httpRouter(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("X-Buildlet-Proxy") != "" {
@@ -2025,9 +2025,10 @@
// import path, it always has forward slashes and no trailing slash.
//
// For example:
-// "net" -> "golang.org/x/net"
-// "crypto" -> "golang.org/x/crypto"
-// "dl" -> "golang.org/dl"
+//
+// "net" -> "golang.org/x/net"
+// "crypto" -> "golang.org/x/crypto"
+// "dl" -> "golang.org/dl"
func importPathOfRepo(repo string) string {
r := repos.ByGerritProject[repo]
if r == nil {
diff --git a/cmd/coordinator/internal/legacydash/ui.go b/cmd/coordinator/internal/legacydash/ui.go
index 33703ae..63cc63c 100644
--- a/cmd/coordinator/internal/legacydash/ui.go
+++ b/cmd/coordinator/internal/legacydash/ui.go
@@ -441,7 +441,8 @@
// failuresView renders https://build.golang.org/?mode=failures, where it outputs
// one line per failure on the front page, in the form:
-// hash builder failure-url
+//
+// hash builder failure-url
type failuresView struct{}
func (failuresView) ShowsActiveBuilds() bool { return false }
diff --git a/cmd/coordinator/remote.go b/cmd/coordinator/remote.go
index c69f2fb..c742f17 100644
--- a/cmd/coordinator/remote.go
+++ b/cmd/coordinator/remote.go
@@ -774,13 +774,13 @@
//
// The instance name is of two forms. The normal form is:
//
-// user-bradfitz-linux-amd64-0
+// user-bradfitz-linux-amd64-0
//
// The overloaded form to convey that the user accepts responsibility
// for changes to the underlying host is to prefix the same instance
// name with the string "mutable-", such as:
//
-// mutable-user-bradfitz-darwin-amd64-10_8-0
+// mutable-user-bradfitz-darwin-amd64-10_8-0
//
// The mutable part is ignored by this function.
func userFromGomoteInstanceName(name string) string {
diff --git a/cmd/coordinator/status.go b/cmd/coordinator/status.go
index 895d4fd..010a107 100644
--- a/cmd/coordinator/status.go
+++ b/cmd/coordinator/status.go
@@ -534,7 +534,6 @@
// and reports when the hourly quota has been exceeded.
//
// It also records metrics to track remaining rate limit over time.
-//
func newGitHubAPIChecker(ctx context.Context, sc *secret.Client) *healthChecker {
// githubRate is the status of the GitHub API v3 client.
// It's of type *github.Rate; no value means no result yet,
diff --git a/cmd/debugnewvm/debugnewvm.go b/cmd/debugnewvm/debugnewvm.go
index c1deee1..69b3db4 100644
--- a/cmd/debugnewvm/debugnewvm.go
+++ b/cmd/debugnewvm/debugnewvm.go
@@ -225,7 +225,9 @@
}
// watchSerial streams the named VM's serial port to log.Printf. It's roughly:
-// gcloud compute connect-to-serial-port --zone=xxx $NAME
+//
+// gcloud compute connect-to-serial-port --zone=xxx $NAME
+//
// but in Go and works. For some reason, gcloud doesn't work as a
// child process and has weird errors.
// TODO(golang.org/issue/39485) - investigate if this is possible for EC2 instances
diff --git a/cmd/fetchlogs/fetchlogs.go b/cmd/fetchlogs/fetchlogs.go
index 66209b3..8abb75a 100644
--- a/cmd/fetchlogs/fetchlogs.go
+++ b/cmd/fetchlogs/fetchlogs.go
@@ -12,7 +12,7 @@
// to be the SHA-1 of their contents). The rev/ directory contains
// symlinks back to these logs named
//
-// rev/<ISO 8601 commit date>-<git revision>/<builder>
+// rev/<ISO 8601 commit date>-<git revision>/<builder>
//
// Fetchlogs will reuse existing log files and revision symlinks, so
// it only has to download logs that are new since the last time it
@@ -22,7 +22,7 @@
// example, to list the revisions and builders with a particular
// failure, use:
//
-// grep -lR <regexp> rev | sort
+// grep -lR <regexp> rev | sort
package main
import (
diff --git a/cmd/gomote/gomote.go b/cmd/gomote/gomote.go
index 84fc46a..fba653d 100644
--- a/cmd/gomote/gomote.go
+++ b/cmd/gomote/gomote.go
@@ -10,68 +10,68 @@
Usage:
- gomote [global-flags] cmd [cmd-flags]
+ gomote [global-flags] cmd [cmd-flags]
- For example,
- $ gomote create openbsd-amd64-60
- user-username-openbsd-amd64-60-0
- $ gomote push user-username-openbsd-amd64-60-0
- $ gomote run user-username-openbsd-amd64-60-0 go/src/make.bash
- $ gomote run user-username-openbsd-amd64-60-0 go/bin/go test -v -short os
+ For example,
+ $ gomote create openbsd-amd64-60
+ user-username-openbsd-amd64-60-0
+ $ gomote push user-username-openbsd-amd64-60-0
+ $ gomote run user-username-openbsd-amd64-60-0 go/src/make.bash
+ $ gomote run user-username-openbsd-amd64-60-0 go/bin/go test -v -short os
To list the subcommands, run "gomote" without arguments:
- Commands:
+ Commands:
- create create a buildlet; with no args, list types of buildlets
- destroy destroy a buildlet
- gettar extract a tar.gz from a buildlet
- list list active buildlets
- ls list the contents of a directory on a buildlet
- ping test whether a buildlet is alive and reachable
- push sync your GOROOT directory to the buildlet
- put put files on a buildlet
- put14 put Go 1.4 in place
- puttar extract a tar.gz to a buildlet
- rm delete files or directories
- rdp RDP (Remote Desktop Protocol) to a Windows buildlet
- run run a command on a buildlet
- ssh ssh to a buildlet
+ create create a buildlet; with no args, list types of buildlets
+ destroy destroy a buildlet
+ gettar extract a tar.gz from a buildlet
+ list list active buildlets
+ ls list the contents of a directory on a buildlet
+ ping test whether a buildlet is alive and reachable
+ push sync your GOROOT directory to the buildlet
+ put put files on a buildlet
+ put14 put Go 1.4 in place
+ puttar extract a tar.gz to a buildlet
+ rm delete files or directories
+ rdp RDP (Remote Desktop Protocol) to a Windows buildlet
+ run run a command on a buildlet
+ ssh ssh to a buildlet
To list all the builder types available, run "create" with no arguments:
- $ gomote create
- (list tons of buildlet types)
+ $ gomote create
+ (list tons of buildlet types)
The "gomote run" command has many of its own flags:
- $ gomote run -h
- run usage: gomote run [run-opts] <instance> <cmd> [args...]
- -builderenv string
- Optional alternate builder to act like. Must share the same
- underlying buildlet host type, or it's an error. For
- instance, linux-amd64-race is compatible
- with linux-amd64, but openbsd-amd64 and openbsd-386 are
- different hosts.
- -debug
- write debug info about the command's execution before it begins
- -dir string
- Directory to run from. Defaults to the directory of the
- command, or the work directory if -system is true.
- -e value
- Environment variable KEY=value. The -e flag may be repeated
- multiple times to add multiple things to the environment.
- -path string
- Comma-separated list of ExecOpts.Path elements. The special
- string 'EMPTY' means to run without any $PATH. The empty
- string (default) does not modify the $PATH. Otherwise, the
- following expansions apply: the string '$PATH' expands to
- the current PATH element(s), the substring '$WORKDIR'
- expands to the buildlet's temp workdir.
- -system
- run inside the system, and not inside the workdir; this is implicit if cmd starts with '/'
+ $ gomote run -h
+ run usage: gomote run [run-opts] <instance> <cmd> [args...]
+ -builderenv string
+ Optional alternate builder to act like. Must share the same
+ underlying buildlet host type, or it's an error. For
+ instance, linux-amd64-race is compatible
+ with linux-amd64, but openbsd-amd64 and openbsd-386 are
+ different hosts.
+ -debug
+ write debug info about the command's execution before it begins
+ -dir string
+ Directory to run from. Defaults to the directory of the
+ command, or the work directory if -system is true.
+ -e value
+ Environment variable KEY=value. The -e flag may be repeated
+ multiple times to add multiple things to the environment.
+ -path string
+ Comma-separated list of ExecOpts.Path elements. The special
+ string 'EMPTY' means to run without any $PATH. The empty
+ string (default) does not modify the $PATH. Otherwise, the
+ following expansions apply: the string '$PATH' expands to
+ the current PATH element(s), the substring '$WORKDIR'
+ expands to the buildlet's temp workdir.
+ -system
+ run inside the system, and not inside the workdir; this is implicit if cmd starts with '/'
-Debugging buildlets directly
+# Debugging buildlets directly
Using "gomote create" contacts the build coordinator
(farmer.golang.org) and requests that it create the buildlet on your
@@ -80,7 +80,6 @@
directly (for example, when working on the buildlet code), you can
skip the "gomote create" step and use the special builder name
"<build-config-name>@ip[:port>", such as "windows-a...@10.1.5.3".
-
*/
package main
diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go
index b0d2a19..84a9ed8 100644
--- a/cmd/gopherbot/gopherbot.go
+++ b/cmd/gopherbot/gopherbot.go
@@ -1389,7 +1389,6 @@
// Provide more helpful info? Amend, don't add 2nd commit, link to a review guide?
// Make this a template? May want to provide more dynamic information in the future.
// Only show freeze message during freeze.
-//
const (
congratsSentence = `Congratulations on opening your first change. Thank you for your contribution!`
@@ -2490,7 +2489,7 @@
// reviewerRe extracts the reviewer's Gerrit ID from a line that looks like:
//
-// Reviewer: Rebecca Stambler <16140@62eb7196-b449-3ce5-99f1-c037f21e1705>
+// Reviewer: Rebecca Stambler <16140@62eb7196-b449-3ce5-99f1-c037f21e1705>
var reviewerRe = regexp.MustCompile(`.* <(?P<id>\d+)@.*>`)
const gerritInstanceID = "@62eb7196-b449-3ce5-99f1-c037f21e1705"
diff --git a/cmd/makemac/makemac.go b/cmd/makemac/makemac.go
index f03822a..e97631c 100644
--- a/cmd/makemac/makemac.go
+++ b/cmd/makemac/makemac.go
@@ -10,8 +10,7 @@
Usage:
- $ makemac <macos_version> # e.g, darwin-10_10, darwin-10_11, darwin-10_15, darwin-amd64-11_0
-
+ $ makemac <macos_version> # e.g, darwin-10_10, darwin-10_11, darwin-10_15, darwin-amd64-11_0
*/
package main
@@ -849,7 +848,7 @@
// Starting with the macOS 10.14 (Mojave) image, their baked-in stage0.sh
// script does:
//
-// while true; do (curl http://172.17.20.2:8713/stage0/$(sw_vers -productVersion)| sh); sleep 5; done
+// while true; do (curl http://172.17.20.2:8713/stage0/$(sw_vers -productVersion)| sh); sleep 5; done
func handleStage0(w http.ResponseWriter, r *http.Request) {
// ver will be like "10.14.4"
ver := strings.TrimPrefix(r.RequestURI, "/stage0/")
diff --git a/cmd/racebuild/racebuild.go b/cmd/racebuild/racebuild.go
index 0036705..1e7bb63 100644
--- a/cmd/racebuild/racebuild.go
+++ b/cmd/racebuild/racebuild.go
@@ -4,6 +4,7 @@
// racebuild builds the race runtime (syso files) on all supported OSes using gomote.
// Usage:
+//
// $ racebuild -rev <llvm_git_revision> -goroot <path_to_go_repo>
package main
diff --git a/cmd/release/upload.go b/cmd/release/upload.go
index bcd82f2..c4e05be 100644
--- a/cmd/release/upload.go
+++ b/cmd/release/upload.go
@@ -45,9 +45,10 @@
}
// fileRe matches the files created by the release tool, such as:
-// go1.5beta2.src.tar.gz
-// go1.5.1.linux-386.tar.gz
-// go1.5.windows-amd64.msi
+//
+// go1.5beta2.src.tar.gz
+// go1.5.1.linux-386.tar.gz
+// go1.5.windows-amd64.msi
var fileRe = regexp.MustCompile(`^(go[a-z0-9-.]+)\.(src|([a-z0-9]+)-([a-z0-9]+)(?:-([a-z0-9.]+))?)\.(tar\.gz|zip|pkg|msi)(.asc)?$`)
func upload(files []string) error {
diff --git a/cmd/retrybuilds/retrybuilds.go b/cmd/retrybuilds/retrybuilds.go
index dd445dc..e24026e 100644
--- a/cmd/retrybuilds/retrybuilds.go
+++ b/cmd/retrybuilds/retrybuilds.go
@@ -7,13 +7,13 @@
//
// Valid usage modes:
//
-// retrybuilds -loghash=f45f0eb8
-// retrybuilds -builder=openbsd-amd64
-// retrybuilds -builder=openbsd-amd64 -hash=6fecb7
-// retrybuilds -redo-flaky
-// retrybuilds -redo-flaky -builder=linux-amd64-clang
-// retrybuilds -substr="failed to find foo"
-// retrybuilds -substr="failed to find foo" -builder=linux-amd64-stretch
+// retrybuilds -loghash=f45f0eb8
+// retrybuilds -builder=openbsd-amd64
+// retrybuilds -builder=openbsd-amd64 -hash=6fecb7
+// retrybuilds -redo-flaky
+// retrybuilds -redo-flaky -builder=linux-amd64-clang
+// retrybuilds -substr="failed to find foo"
+// retrybuilds -substr="failed to find foo" -builder=linux-amd64-stretch
package main
import (
diff --git a/cmd/updatestd/updatestd.go b/cmd/updatestd/updatestd.go
index 32a1092..8588753 100644
--- a/cmd/updatestd/updatestd.go
+++ b/cmd/updatestd/updatestd.go
@@ -138,16 +138,15 @@
// UpdateModule updates the standard library module found in dir:
//
-// 1. Set the expected Go version in go.mod file to w.GoVersion.
-// 2. For modules in the build list with "golang.org/x/" prefix,
-// update to pseudo-version corresponding to w.ProjectHashes.
-// 3. Run go mod tidy.
-// 4. Run go mod vendor.
+// 1. Set the expected Go version in go.mod file to w.GoVersion.
+// 2. For modules in the build list with "golang.org/x/" prefix,
+// update to pseudo-version corresponding to w.ProjectHashes.
+// 3. Run go mod tidy.
+// 4. Run go mod vendor.
//
// The logic in this method needs to serve the dependency update
// policy for the purpose of golang.org/issue/36905, although it
// does not directly define said policy.
-//
func (w Work) UpdateModule(dir string) error {
// Determine the build list.
main, deps := buildList(dir)
diff --git a/cmd/xb/xb.go b/cmd/xb/xb.go
index 45b21e0..b897587 100644
--- a/cmd/xb/xb.go
+++ b/cmd/xb/xb.go
@@ -8,14 +8,13 @@
//
// Usage:
//
-// xb {--prod,--staging} <CMD> [<ARGS>...]
+// xb {--prod,--staging} <CMD> [<ARGS>...]
//
// Examples:
//
-// xb --staging kubectl ...
-// xb --prod kubectl ...
-// xb google-email # print the @google.com account from gcloud
-//
+// xb --staging kubectl ...
+// xb --prod kubectl ...
+// xb google-email # print the @google.com account from gcloud
package main // import "golang.org/x/build/cmd/xb"
import (
diff --git a/devapp/server.go b/devapp/server.go
index c6e15de..dcfd5b6 100644
--- a/devapp/server.go
+++ b/devapp/server.go
@@ -232,11 +232,17 @@
}
// handleDirRedirect accepts requests of the form:
-// /dir/REPO/some/dir/
+//
+// /dir/REPO/some/dir/
+//
// And redirects them to either:
-// https://github.com/golang/REPO/tree/master/some/dir/
+//
+// https://github.com/golang/REPO/tree/master/some/dir/
+//
// or:
-// https://go.googlesource.com/REPO/+/master/some/dir/
+//
+// https://go.googlesource.com/REPO/+/master/some/dir/
+//
// ... depending on the Referer. This is so we can make links
// in Markdown docs that are clickable on both GitHub and
// in the go.googlesource.com viewer. If detection fails, we
diff --git a/devapp/title.go b/devapp/title.go
index 139a28d..bce615a 100644
--- a/devapp/title.go
+++ b/devapp/title.go
@@ -15,18 +15,17 @@
//
// Supported forms include:
//
-// "root", "import/path: change title" -> ["root/import/path"], "change title"
-// "root", "path1, path2: change title" -> ["root/path1", "root/path2"], "change title" # Multiple comma-separated paths.
+// "root", "import/path: change title" -> ["root/import/path"], "change title"
+// "root", "path1, path2: change title" -> ["root/path1", "root/path2"], "change title" # Multiple comma-separated paths.
//
// If there's no path prefix (preceded by ": "), title is returned unmodified
// with a paths list containing root:
//
-// "root", "change title" -> ["root"], "change title"
+// "root", "change title" -> ["root"], "change title"
//
// If there's a branch prefix in square brackets, title is returned with said prefix:
//
-// "root", "[branch] path: change title" -> ["root/path"], "[branch] change title"
-//
+// "root", "[branch] path: change title" -> ["root/path"], "[branch] change title"
func ParsePrefixedChangeTitle(root, prefixedTitle string) (paths []string, title string) {
// Parse branch prefix in square brackets, if any.
// E.g., "[branch] path: change title" -> "[branch] ", "path: change title".
diff --git a/env/corellium/ios/files/arwrap.go b/env/corellium/ios/files/arwrap.go
index 0c1f573..95f1e36 100755
--- a/env/corellium/ios/files/arwrap.go
+++ b/env/corellium/ios/files/arwrap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// The arhost binary is a wrapper for llvm-ar, designed to be called by
diff --git a/env/corellium/ios/files/clangwrap.go b/env/corellium/ios/files/clangwrap.go
index 7278e47..62a0b65 100755
--- a/env/corellium/ios/files/clangwrap.go
+++ b/env/corellium/ios/files/clangwrap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// The clanghost binary is like clangwrap.sh but for self-hosted iOS.
diff --git a/internal/coordinator/pool/reverse.go b/internal/coordinator/pool/reverse.go
index 2a96d92..1602696 100644
--- a/internal/coordinator/pool/reverse.go
+++ b/internal/coordinator/pool/reverse.go
@@ -368,7 +368,7 @@
}
// WriteHTMLStatus writes a status of the reverse buildlet pool, in HTML format,
-// to the passed in io.Writer.
+// to the passed in io.Writer.
func (p *ReverseBuildletPool) WriteHTMLStatus(w io.Writer) {
// total maps from a host type to the number of machines which are
// capable of that role.
diff --git a/internal/gophers/gophers.go b/internal/gophers/gophers.go
index 0ef9f40..19b4b33 100644
--- a/internal/gophers/gophers.go
+++ b/internal/gophers/gophers.go
@@ -80,7 +80,6 @@
// • email (for example, "dmit...@golang.org")
//
// Only exact matches are supported.
-//
func GetPerson(id string) *Person {
return idToPerson[strings.ToLower(id)]
}
diff --git a/internal/relui/content.go b/internal/relui/content.go
index 114d1ce..242d425 100644
--- a/internal/relui/content.go
+++ b/internal/relui/content.go
@@ -7,14 +7,17 @@
import "embed"
// static is our static web server content.
+//
//go:embed static
var static embed.FS
// templates are our template files.
+//
//go:embed templates
var templates embed.FS
// migrations are database migration SQL files generated by
// golang-migrate.
+//
//go:embed migrations
var migrations embed.FS
diff --git a/internal/relui/web_test.go b/internal/relui/web_test.go
index 6cfddb0..8fe1f0f 100644
--- a/internal/relui/web_test.go
+++ b/internal/relui/web_test.go
@@ -29,6 +29,7 @@
)
// testStatic is our static web server content.
+//
//go:embed testing
var testStatic embed.FS
diff --git a/internal/spanlog/spanlog.go b/internal/spanlog/spanlog.go
index 1040e89..ff0f950 100644
--- a/internal/spanlog/spanlog.go
+++ b/internal/spanlog/spanlog.go
@@ -17,10 +17,10 @@
// Span is a handle that can eventually be closed.
// Typical usage:
//
-// sp := sl.CreateSpan("slow_operation")
-// result, err := doSlowOperation()
-// sp.Done(err)
-// // do something with result, err
+// sp := sl.CreateSpan("slow_operation")
+// result, err := doSlowOperation()
+// sp.Done(err)
+// // do something with result, err
type Span interface {
// Done marks a span as done.
// The err is returned unmodified for convenience at callsites.
diff --git a/internal/task/dlcl.go b/internal/task/dlcl.go
index 61e919a..061aedc 100644
--- a/internal/task/dlcl.go
+++ b/internal/task/dlcl.go
@@ -22,9 +22,9 @@
// specified Go versions. It accepts one or two versions only.
//
// The versions must use the same format as Go tags. For example:
-// • "go1.17.2" and "go1.16.9" for a minor Go release
-// • "go1.18" for a major Go release
-// • "go1.18beta1" or "go1.18rc1" for a pre-release
+// - "go1.17.2" and "go1.16.9" for a minor Go release
+// - "go1.18" for a major Go release
+// - "go1.18beta1" or "go1.18rc1" for a pre-release
//
// On success, the URL of the change is returned, like "https://go.dev/cl/123".
func MailDLCL(ctx *workflow.TaskContext, versions []string, e ExternalConfig) (changeURL string, _ error) {
diff --git a/kubernetes/api/quantity.go b/kubernetes/api/quantity.go
index 8205f65..1457049 100644
--- a/kubernetes/api/quantity.go
+++ b/kubernetes/api/quantity.go
@@ -32,19 +32,19 @@
//
// The serialization format is:
//
-// <quantity> ::= <signedNumber><suffix>
-// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
-// <digit> ::= 0 | 1 | ... | 9
-// <digits> ::= <digit> | <digit><digits>
-// <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits>
-// <sign> ::= "+" | "-"
-// <signedNumber> ::= <number> | <sign><number>
-// <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI>
-// <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
-// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
-// <decimalSI> ::= m | "" | k | M | G | T | P | E
-// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
-// <decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber>
+// <quantity> ::= <signedNumber><suffix>
+// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
+// <digit> ::= 0 | 1 | ... | 9
+// <digits> ::= <digit> | <digit><digits>
+// <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits>
+// <sign> ::= "+" | "-"
+// <signedNumber> ::= <number> | <sign><number>
+// <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI>
+// <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
+// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
+// <decimalSI> ::= m | "" | k | M | G | T | P | E
+// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
+// <decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber>
//
// No matter which of the three exponent forms is used, no quantity may represent
// a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal
@@ -58,19 +58,22 @@
// Before serializing, Quantity will be put in "canonical form".
// This means that Exponent/suffix will be adjusted up or down (with a
// corresponding increase or decrease in Mantissa) such that:
-// a. No precision is lost
-// b. No fractional digits will be emitted
-// c. The exponent (or suffix) is as large as possible.
+//
+// a. No precision is lost
+// b. No fractional digits will be emitted
+// c. The exponent (or suffix) is as large as possible.
+//
// The sign will be omitted unless the number is negative.
//
// Examples:
-// 1.5 will be serialized as "1500m"
-// 1.5Gi will be serialized as "1536Mi"
+//
+// 1.5 will be serialized as "1500m"
+// 1.5Gi will be serialized as "1536Mi"
//
// NOTE: We reserve the right to amend this canonical format, perhaps to
-// allow 1.5 to be canonical.
+// allow 1.5 to be canonical.
// TODO: Remove above disclaimer after all bikeshedding about format is over,
-// or after March 2015.
+// or after March 2015.
//
// Note that the quantity will NEVER be internally represented by a
// floating point number. That is the whole point of this exercise.
@@ -229,10 +232,10 @@
// Canonicalize returns the canonical form of q and its suffix (see comment on Quantity).
//
// Note about BinarySI:
-// * If q.Format is set to BinarySI and q.Amount represents a non-zero value between
-// -1 and +1, it will be emitted as if q.Format were DecimalSI.
-// * Otherwise, if q.Format is set to BinarySI, frational parts of q.Amount will be
-// rounded up. (1.1i becomes 2i.)
+// - If q.Format is set to BinarySI and q.Amount represents a non-zero value between
+// -1 and +1, it will be emitted as if q.Format were DecimalSI.
+// - Otherwise, if q.Format is set to BinarySI, frational parts of q.Amount will be
+// rounded up. (1.1i becomes 2i.)
func (q *Quantity) Canonicalize() (string, suffix) {
if q.Amount == nil {
return "0", ""
diff --git a/kubernetes/api/types.go b/kubernetes/api/types.go
index 9bd908b..67220ad 100644
--- a/kubernetes/api/types.go
+++ b/kubernetes/api/types.go
@@ -1608,17 +1608,18 @@
}
// Endpoints is a collection of endpoints that implement the actual service. Example:
-// Name: "mysvc",
-// Subsets: [
-// {
-// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}],
-// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}]
-// },
-// {
-// Addresses: [{"ip": "10.10.3.3"}],
-// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}]
-// },
-// ]
+//
+// Name: "mysvc",
+// Subsets: [
+// {
+// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}],
+// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}]
+// },
+// {
+// Addresses: [{"ip": "10.10.3.3"}],
+// Ports: [{"name": "a", "port": 93}, {"name": "b", "port": 76}]
+// },
+// ]
type Endpoints struct {
TypeMeta `json:",inline"`
// Standard object's metadata.
@@ -1633,13 +1634,16 @@
// EndpointSubset is a group of addresses with a common set of ports. The
// expanded set of endpoints is the Cartesian product of Addresses x Ports.
// For example, given:
-// {
-// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}],
-// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}]
-// }
+//
+// {
+// Addresses: [{"ip": "10.10.1.1"}, {"ip": "10.10.2.2"}],
+// Ports: [{"name": "a", "port": 8675}, {"name": "b", "port": 309}]
+// }
+//
// The resulting set of endpoints can be viewed as:
-// a: [ 10.10.1.1:8675, 10.10.2.2:8675 ],
-// b: [ 10.10.1.1:309, 10.10.2.2:309 ]
+//
+// a: [ 10.10.1.1:8675, 10.10.2.2:8675 ],
+// b: [ 10.10.1.1:309, 10.10.2.2:309 ]
type EndpointSubset struct {
// IP addresses which offer the related ports.
Addresses []EndpointAddress `json:"addresses,omitempty"`
diff --git a/maintner/gerrit.go b/maintner/gerrit.go
index cb29b15..0b10404 100644
--- a/maintner/gerrit.go
+++ b/maintner/gerrit.go
@@ -375,8 +375,10 @@
// lineValueOK extracts a value from an RFC 822-style "key: value" series of lines.
// If all is,
-// foo: bar
-// bar: baz
+//
+// foo: bar
+// bar: baz
+//
// lineValue(all, "foo:") returns "bar". It trims any whitespace.
// The prefix is case sensitive and must include the colon.
// The ok value reports whether a line with such a prefix is found, even if its
@@ -600,7 +602,7 @@
// The Go Gerrit site does not really use the "draft" status much, but if
// you need to test it, create a dummy commit and then run
//
-// git push origin HEAD:refs/drafts/master
+// git push origin HEAD:refs/drafts/master
var statuses = []string{"merged", "abandoned", "draft", "new"}
// getGerritStatus returns a Gerrit status for a commit, or the empty string to
@@ -954,11 +956,12 @@
// fd1e71f1594ce64941a85428ddef2fbb0ad1023e refs/changes/99/30599/3
//
// Capture values:
-// $0: whole match
-// $1: "fd1e71f1594ce64941a85428ddef2fbb0ad1023e"
-// $2: "30599" (CL number)
-// $3: "1", "2" (patchset number) or "meta" (a/ special commit
-// holding the comments for a commit)
+//
+// $0: whole match
+// $1: "fd1e71f1594ce64941a85428ddef2fbb0ad1023e"
+// $2: "30599" (CL number)
+// $3: "1", "2" (patchset number) or "meta" (a/ special commit
+// holding the comments for a commit)
//
// The "99" in the middle covers all CL's that end in "99", so
// refs/changes/99/99/1, refs/changes/99/199/meta.
@@ -1564,13 +1567,13 @@
// parseGerritLabelValue parses a Gerrit NoteDb "Label: ..." value.
// It can take forms and return values such as:
//
-// "Run-TryBot=+1" => ("Run-TryBot", 1, "")
-// "-Run-TryBot" => ("-Run-TryBot", 0, "")
-// "-Run-TryBot " => ("-Run-TryBot", 0, "")
-// "Run-TryBot=+1 Brad Fitzpatrick <5065@62eb7196-b449-3ce5-99f1-c037f21e1705>" =>
-// ("Run-TryBot", 1, "5065@62eb7196-b449-3ce5-99f1-c037f21e1705")
-// "-TryBot-Result Gobot Gobot <5976@62eb7196-b449-3ce5-99f1-c037f21e1705>" =>
-// ("-TryBot-Result", 0, "5976@62eb7196-b449-3ce5-99f1-c037f21e1705")
+// "Run-TryBot=+1" => ("Run-TryBot", 1, "")
+// "-Run-TryBot" => ("-Run-TryBot", 0, "")
+// "-Run-TryBot " => ("-Run-TryBot", 0, "")
+// "Run-TryBot=+1 Brad Fitzpatrick <5065@62eb7196-b449-3ce5-99f1-c037f21e1705>" =>
+// ("Run-TryBot", 1, "5065@62eb7196-b449-3ce5-99f1-c037f21e1705")
+// "-TryBot-Result Gobot Gobot <5976@62eb7196-b449-3ce5-99f1-c037f21e1705>" =>
+// ("-TryBot-Result", 0, "5976@62eb7196-b449-3ce5-99f1-c037f21e1705")
func parseGerritLabelValue(v string) (label string, value int8, whose string) {
space := strings.IndexByte(v, ' ')
if space != -1 {
diff --git a/maintner/git.go b/maintner/git.go
index 6e9299f..a1852fd 100644
--- a/maintner/git.go
+++ b/maintner/git.go
@@ -466,7 +466,9 @@
// parsePerson parses an "author" or "committer" value from "git cat-file -p COMMIT"
// The values are like:
-// Foo Bar <foo...@gmail.com> 1488624439 +0900
+//
+// Foo Bar <foo...@gmail.com> 1488624439 +0900
+//
// c.mu must be held for writing.
func (c *Corpus) parsePerson(v []byte) (*GitPerson, time.Time, error) {
v = bytes.TrimSpace(v)
diff --git a/maintner/github.go b/maintner/github.go
index 5965685..1684d78 100644
--- a/maintner/github.go
+++ b/maintner/github.go
@@ -1448,9 +1448,9 @@
// githubCache is an httpcache.Cache wrapper that only
// stores responses for:
-// * https://api.github.com/repos/$OWNER/$REPO/issues?direction=desc&page=1&sort=updated
-// * https://api.github.com/repos/$OWNER/$REPO/milestones?page=1
-// * https://api.github.com/repos/$OWNER/$REPO/labels?page=1
+// - https://api.github.com/repos/$OWNER/$REPO/issues?direction=desc&page=1&sort=updated
+// - https://api.github.com/repos/$OWNER/$REPO/milestones?page=1
+// - https://api.github.com/repos/$OWNER/$REPO/labels?page=1
type githubCache struct {
httpcache.Cache
}
diff --git a/maintner/internal/robustio/robustio.go b/maintner/internal/robustio/robustio.go
index 3f061e4..6ca7b0f 100644
--- a/maintner/internal/robustio/robustio.go
+++ b/maintner/internal/robustio/robustio.go
@@ -46,9 +46,9 @@
// in this package attempt to mitigate.
//
// Errors considered ephemeral include:
-// - syscall.ERROR_ACCESS_DENIED
-// - syscall.ERROR_FILE_NOT_FOUND
-// - internal/syscall/windows.ERROR_SHARING_VIOLATION
+// - syscall.ERROR_ACCESS_DENIED
+// - syscall.ERROR_FILE_NOT_FOUND
+// - internal/syscall/windows.ERROR_SHARING_VIOLATION
//
// This set may be expanded in the future; programs must not rely on the
// non-ephemerality of any given error.
diff --git a/maintner/maintner.go b/maintner/maintner.go
index 41786aa..3788b99 100644
--- a/maintner/maintner.go
+++ b/maintner/maintner.go
@@ -179,7 +179,6 @@
// TrackGoGitRepo registers a git directory to have its metadata slurped into the corpus.
// The goRepo is a name like "go" or "net". The dir is a path on disk.
-//
func (c *Corpus) TrackGoGitRepo(goRepo, dir string) {
if c.mutationLogger == nil {
panic("can't TrackGoGitRepo in non-leader mode")
diff --git a/maintner/maintpb/maintner.pb.go b/maintner/maintpb/maintner.pb.go
index e209fad..939d311 100644
--- a/maintner/maintpb/maintner.pb.go
+++ b/maintner/maintpb/maintner.pb.go
@@ -5,9 +5,11 @@
Package maintpb is a generated protocol buffer package.
It is generated from these files:
+
maintner.proto
It has these top-level messages:
+
Mutation
GithubMutation
GithubIssueMutation
diff --git a/perf/app/parse.go b/perf/app/parse.go
index 59a23fd..74feed1 100644
--- a/perf/app/parse.go
+++ b/perf/app/parse.go
@@ -8,9 +8,11 @@
// parseQueryString splits a user-entered query into one or more perfdata server queries.
// The supported query formats are:
-// prefix | one vs two - parsed as "prefix", {"one", "two"}
-// prefix one vs two - parsed as "", {"prefix one", "two"}
-// anything else - parsed as "", {"anything else"}
+//
+// prefix | one vs two - parsed as "prefix", {"one", "two"}
+// prefix one vs two - parsed as "", {"prefix one", "two"}
+// anything else - parsed as "", {"anything else"}
+//
// The vs and | separators must not be quoted.
func parseQueryString(q string) (string, []string) {
var queries []string
diff --git a/perf/app/trend.go b/perf/app/trend.go
index 67fb871..63b2065 100644
--- a/perf/app/trend.go
+++ b/perf/app/trend.go
@@ -321,12 +321,16 @@
// aggResults pivots the table, taking the columns in Values and making a new column for each distinct value in Across.
// aggResults("in", []string{"value1", "value2"} will reshape a table like
-// in value1 value2
-// one 1 2
-// two 3 4
+//
+// in value1 value2
+// one 1 2
+// two 3 4
+//
// and will turn in into a table like
-// one/value1 one/value2 two/value1 two/value2
-// 1 2 3 4
+//
+// one/value1 one/value2 two/value1 two/value2
+// 1 2 3 4
+//
// across columns must be []string, and value columns must be []float64.
type aggResults struct {
// Across is the name of the column whose values are the column prefix.
diff --git a/perfdata/client.go b/perfdata/client.go
index c609e7f..285bc35 100644
--- a/perfdata/client.go
+++ b/perfdata/client.go
@@ -107,15 +107,15 @@
// UploadList is the result of ListUploads.
// Use Next to advance through the rows, making sure to call Close when done:
//
-// q := db.ListUploads("key:value")
-// defer q.Close()
-// for q.Next() {
-// id, count := q.Row()
-// labels := q.LabelValues()
-// ...
-// }
-// err = q.Err() // get any error encountered during iteration
-// ...
+// q := db.ListUploads("key:value")
+// defer q.Close()
+// for q.Next() {
+// id, count := q.Row()
+// labels := q.LabelValues()
+// ...
+// }
+// err = q.Err() // get any error encountered during iteration
+// ...
type UploadList struct {
body io.Closer
dec *json.Decoder
@@ -214,16 +214,16 @@
// An Upload is an in-progress upload.
// Use CreateFile to upload one or more files, then call Commit or Abort.
//
-// u := client.NewUpload()
-// w, err := u.CreateFile()
-// if err != nil {
-// u.Abort()
-// return err
-// }
-// fmt.Fprintf(w, "BenchmarkResult 1 1 ns/op\n")
-// if err := u.Commit(); err != nil {
-// return err
-// }
+// u := client.NewUpload()
+// w, err := u.CreateFile()
+// if err != nil {
+// u.Abort()
+// return err
+// }
+// fmt.Fprintf(w, "BenchmarkResult 1 1 ns/op\n")
+// if err := u.Commit(); err != nil {
+// return err
+// }
type Upload struct {
pw io.WriteCloser
mpw *multipart.Writer
diff --git a/perfdata/cmd/reindex/reindex.go b/perfdata/cmd/reindex/reindex.go
index cb87270..f243f61 100644
--- a/perfdata/cmd/reindex/reindex.go
+++ b/perfdata/cmd/reindex/reindex.go
@@ -25,8 +25,8 @@
"cloud.google.com/go/storage"
_ "github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql"
- "golang.org/x/perf/storage/benchfmt"
"golang.org/x/build/perfdata/db"
+ "golang.org/x/perf/storage/benchfmt"
"google.golang.org/api/iterator"
)
diff --git a/perfdata/db/db.go b/perfdata/db/db.go
index 499ef7c..75ab32c 100644
--- a/perfdata/db/db.go
+++ b/perfdata/db/db.go
diff --git a/perfdata/localperfdata/app.go b/perfdata/localperfdata/app.go
index 6108bf7..9614c99 100644
--- a/perfdata/localperfdata/app.go
+++ b/perfdata/localperfdata/app.go
@@ -9,7 +9,7 @@
//
// Usage:
//
-// localperfdata [-addr address] [-view_url_base url] [-base_dir ../appengine] [-dsn file.db]
+// localperfdata [-addr address] [-view_url_base url] [-base_dir ../appengine] [-dsn file.db]
package main
import (
To view, visit change 399555. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: http2/http2.go
Insertions: 2, Deletions: 2.
@@ -365,8 +365,8 @@
// validPseudoPath reports whether v is a valid :path pseudo-header
// value. It must be either:
//
-// *) a non-empty string starting with '/'
-// *) the string '*', for OPTIONS requests.
+// - a non-empty string starting with '/'
+// - the string '*', for OPTIONS requests.
//
// For now this is only used a quick check for deciding when to clean
// up Opaque URLs before sending requests from the Transport.
```
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Iae68a9cd600060577271575e893ecb23bed1e509
Reviewed-on: https://go-review.googlesource.com/c/net/+/399599
Run-TryBot: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
Auto-Submit: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
---
M bpf/doc.go
M context/context.go
M context/go17.go
M context/pre_go17.go
M dns/dnsmessage/message.go
M http/httpguts/httplex.go
M http2/h2i/h2i.go
M http2/http2.go
M http2/server.go
M http2/server_test.go
M http2/transport_test.go
M icmp/listen_posix.go
M icmp/listen_stub.go
M idna/trieval.go
M internal/socket/zsys_linux_ppc.go
M ipv4/doc.go
M ipv6/doc.go
M publicsuffix/list.go
M publicsuffix/table.go
M webdav/file.go
M webdav/internal/xml/marshal.go
M webdav/internal/xml/read.go
M webdav/lock_test.go
M webdav/webdav.go
M webdav/xml_test.go
M websocket/websocket.go
26 files changed, 222 insertions(+), 197 deletions(-)
diff --git a/bpf/doc.go b/bpf/doc.go
index ae62feb..04ec1c8 100644
--- a/bpf/doc.go
+++ b/bpf/doc.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
/*
-
Package bpf implements marshaling and unmarshaling of programs for the
Berkeley Packet Filter virtual machine, and provides a Go implementation
of the virtual machine.
@@ -21,7 +20,7 @@
allowed, they can only jump forwards, to guarantee that there are no
infinite loops.
-The virtual machine
+# The virtual machine
The BPF VM is an accumulator machine. Its main register, called
register A, is an implicit source and destination in all arithmetic
@@ -50,7 +49,7 @@
functions. Currently, the only extensions supported by this package
are the Linux packet filter extensions.
-Examples
+# Examples
This packet filter selects all ARP packets.
@@ -77,6 +76,5 @@
// Ignore.
bpf.RetConstant{Val: 0},
})
-
*/
package bpf // import "golang.org/x/net/bpf"
diff --git a/context/context.go b/context/context.go
index a3c021d..cf66309 100644
--- a/context/context.go
+++ b/context/context.go
@@ -21,9 +21,9 @@
// explicitly to each function that needs it. The Context should be the first
// parameter, typically named ctx:
//
-// func DoSomething(ctx context.Context, arg Arg) error {
-// // ... use ctx ...
-// }
+// func DoSomething(ctx context.Context, arg Arg) error {
+// // ... use ctx ...
+// }
//
// Do not pass a nil Context, even if a function permits it. Pass context.TODO
// if you are unsure about which Context to use.
diff --git a/context/go17.go b/context/go17.go
index 344bd14..0a54bdb 100644
--- a/context/go17.go
+++ b/context/go17.go
@@ -54,11 +54,11 @@
// Canceling this context releases resources associated with it, so code should
// call cancel as soon as the operations running in this Context complete:
//
-// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
-// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
-// defer cancel() // releases resources if slowOperation completes before timeout elapses
-// return slowOperation(ctx)
-// }
+// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
+// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
+// defer cancel() // releases resources if slowOperation completes before timeout elapses
+// return slowOperation(ctx)
+// }
func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
return WithDeadline(parent, time.Now().Add(timeout))
}
diff --git a/context/pre_go17.go b/context/pre_go17.go
index 5270db5..7b6b685 100644
--- a/context/pre_go17.go
+++ b/context/pre_go17.go
@@ -264,11 +264,11 @@
// Canceling this context releases resources associated with it, so code should
// call cancel as soon as the operations running in this Context complete:
//
-// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
-// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
-// defer cancel() // releases resources if slowOperation completes before timeout elapses
-// return slowOperation(ctx)
-// }
+// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
+// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
+// defer cancel() // releases resources if slowOperation completes before timeout elapses
+// return slowOperation(ctx)
+// }
func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
return WithDeadline(parent, time.Now().Add(timeout))
}
diff --git a/dns/dnsmessage/message.go b/dns/dnsmessage/message.go
index 8c24430..0cdf89f 100644
--- a/dns/dnsmessage/message.go
+++ b/dns/dnsmessage/message.go
@@ -1173,6 +1173,7 @@
// A Builder allows incrementally packing a DNS message.
//
// Example usage:
+//
// buf := make([]byte, 2, 514)
// b := NewBuilder(buf, Header{...})
// b.EnableCompression()
diff --git a/http/httpguts/httplex.go b/http/httpguts/httplex.go
index c79aa73..6e071e8 100644
--- a/http/httpguts/httplex.go
+++ b/http/httpguts/httplex.go
@@ -173,13 +173,15 @@
// isLWS reports whether b is linear white space, according
// to http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2
-// LWS = [CRLF] 1*( SP | HT )
+//
+// LWS = [CRLF] 1*( SP | HT )
func isLWS(b byte) bool { return b == ' ' || b == '\t' }
// isCTL reports whether b is a control byte, according
// to http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2
-// CTL = <any US-ASCII control character
-// (octets 0 - 31) and DEL (127)>
+//
+// CTL = <any US-ASCII control character
+// (octets 0 - 31) and DEL (127)>
func isCTL(b byte) bool {
const del = 0x7f // a CTL
return b < ' ' || b == del
@@ -189,12 +191,13 @@
// HTTP/2 imposes the additional restriction that uppercase ASCII
// letters are not allowed.
//
-// RFC 7230 says:
-// header-field = field-name ":" OWS field-value OWS
-// field-name = token
-// token = 1*tchar
-// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
-// "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
+// RFC 7230 says:
+//
+// header-field = field-name ":" OWS field-value OWS
+// field-name = token
+// token = 1*tchar
+// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
+// "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
func ValidHeaderFieldName(v string) bool {
if len(v) == 0 {
return false
@@ -267,27 +270,28 @@
// ValidHeaderFieldValue reports whether v is a valid "field-value" according to
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 :
//
-// message-header = field-name ":" [ field-value ]
-// field-value = *( field-content | LWS )
-// field-content = <the OCTETs making up the field-value
-// and consisting of either *TEXT or combinations
-// of token, separators, and quoted-string>
+// message-header = field-name ":" [ field-value ]
+// field-value = *( field-content | LWS )
+// field-content = <the OCTETs making up the field-value
+// and consisting of either *TEXT or combinations
+// of token, separators, and quoted-string>
//
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 :
//
-// TEXT = <any OCTET except CTLs,
-// but including LWS>
-// LWS = [CRLF] 1*( SP | HT )
-// CTL = <any US-ASCII control character
-// (octets 0 - 31) and DEL (127)>
+// TEXT = <any OCTET except CTLs,
+// but including LWS>
+// LWS = [CRLF] 1*( SP | HT )
+// CTL = <any US-ASCII control character
+// (octets 0 - 31) and DEL (127)>
//
// RFC 7230 says:
-// field-value = *( field-content / obs-fold )
-// obj-fold = N/A to http2, and deprecated
-// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
-// field-vchar = VCHAR / obs-text
-// obs-text = %x80-FF
-// VCHAR = "any visible [USASCII] character"
+//
+// field-value = *( field-content / obs-fold )
+// obj-fold = N/A to http2, and deprecated
+// field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
+// field-vchar = VCHAR / obs-text
+// obs-text = %x80-FF
+// VCHAR = "any visible [USASCII] character"
//
// http2 further says: "Similarly, HTTP/2 allows header field values
// that are not valid. While most of the values that can be encoded
diff --git a/http2/h2i/h2i.go b/http2/h2i/h2i.go
index 4fa243f..901f6ca 100644
--- a/http2/h2i/h2i.go
+++ b/http2/h2i/h2i.go
@@ -9,14 +9,15 @@
The h2i command is an interactive HTTP/2 console.
Usage:
- $ h2i [flags] <hostname>
+
+ $ h2i [flags] <hostname>
Interactive commands in the console: (all parts case-insensitive)
- ping [data]
- settings ack
- settings FOO=n BAR=z
- headers (open a new stream by typing HTTP/1.1)
+ ping [data]
+ settings ack
+ settings FOO=n BAR=z
+ headers (open a new stream by typing HTTP/1.1)
*/
package main
diff --git a/http2/http2.go b/http2/http2.go
index 5571ccf..479ba4b 100644
--- a/http2/http2.go
+++ b/http2/http2.go
@@ -13,7 +13,6 @@
// See https://http2.github.io/ for more information on HTTP/2.
//
// See https://http2.golang.org/ for a test server running this code.
-//
package http2 // import "golang.org/x/net/http2"
import (
@@ -176,10 +175,11 @@
// name (key). See httpguts.ValidHeaderName for the base rules.
//
// Further, http2 says:
-// "Just as in HTTP/1.x, header field names are strings of ASCII
-// characters that are compared in a case-insensitive
-// fashion. However, header field names MUST be converted to
-// lowercase prior to their encoding in HTTP/2. "
+//
+// "Just as in HTTP/1.x, header field names are strings of ASCII
+// characters that are compared in a case-insensitive
+// fashion. However, header field names MUST be converted to
+// lowercase prior to their encoding in HTTP/2. "
func validWireHeaderFieldName(v string) bool {
if len(v) == 0 {
return false
@@ -365,8 +365,8 @@
// validPseudoPath reports whether v is a valid :path pseudo-header
// value. It must be either:
//
-// *) a non-empty string starting with '/'
-// *) the string '*', for OPTIONS requests.
+// - a non-empty string starting with '/'
+// - the string '*', for OPTIONS requests.
//
// For now this is only used a quick check for deciding when to clean
// up Opaque URLs before sending requests from the Transport.
diff --git a/http2/server.go b/http2/server.go
index e644d9b..33765d3 100644
--- a/http2/server.go
+++ b/http2/server.go
@@ -2546,8 +2546,9 @@
// prior to the headers being written. If the set of trailers is fixed
// or known before the header is written, the normal Go trailers mechanism
// is preferred:
-// https://golang.org/pkg/net/http/#ResponseWriter
-// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
+//
+// https://golang.org/pkg/net/http/#ResponseWriter
+// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
const TrailerPrefix = "Trailer:"
// promoteUndeclaredTrailers permits http.Handlers to set trailers
diff --git a/http2/server_test.go b/http2/server_test.go
index a1b1b2b..46ac6ee 100644
--- a/http2/server_test.go
+++ b/http2/server_test.go
@@ -2702,8 +2702,9 @@
}
// TestServerWithCurl currently fails, hence the LenientCipherSuites test. See:
-// https://github.com/tatsuhiro-t/nghttp2/issues/140 &
-// http://sourceforge.net/p/curl/bugs/1472/
+//
+// https://github.com/tatsuhiro-t/nghttp2/issues/140 &
+// http://sourceforge.net/p/curl/bugs/1472/
func TestServerWithCurl(t *testing.T) { testServerWithCurl(t, false) }
func TestServerWithCurl_LenientCipherSuites(t *testing.T) { testServerWithCurl(t, true) }
diff --git a/http2/transport_test.go b/http2/transport_test.go
index 030cbe9..c027255 100644
--- a/http2/transport_test.go
+++ b/http2/transport_test.go
@@ -1155,7 +1155,9 @@
)
// Test all 36 combinations of response frame orders:
-// (3 ways of 100-continue) * (2 ways of headers) * (2 ways of data) * (3 ways of trailers):func TestTransportResponsePattern_00f0(t *testing.T) { testTransportResponsePattern(h0, h1, false, h0) }
+//
+// (3 ways of 100-continue) * (2 ways of headers) * (2 ways of data) * (3 ways of trailers):func TestTransportResponsePattern_00f0(t *testing.T) { testTransportResponsePattern(h0, h1, false, h0) }
+//
// Generated by http://play.golang.org/p/SScqYKJYXd
func TestTransportResPattern_c0h1d0t0(t *testing.T) { testTransportResPattern(t, f0, f1, d0, f0) }
func TestTransportResPattern_c0h1d0t1(t *testing.T) { testTransportResPattern(t, f0, f1, d0, f1) }
@@ -1575,8 +1577,9 @@
}
// headerListSize returns the HTTP2 header list size of h.
-// http://httpwg.org/specs/rfc7540.html#SETTINGS_MAX_HEADER_LIST_SIZE
-// http://httpwg.org/specs/rfc7540.html#MaxHeaderBlock
+//
+// http://httpwg.org/specs/rfc7540.html#SETTINGS_MAX_HEADER_LIST_SIZE
+// http://httpwg.org/specs/rfc7540.html#MaxHeaderBlock
func headerListSize(h http.Header) (size uint32) {
for k, vv := range h {
for _, v := range vv {
diff --git a/icmp/listen_posix.go b/icmp/listen_posix.go
index bcad739..6aea804 100644
--- a/icmp/listen_posix.go
+++ b/icmp/listen_posix.go
@@ -29,6 +29,7 @@
// Currently only Darwin and Linux support this.
//
// Examples:
+//
// ListenPacket("udp4", "192.168.0.1")
// ListenPacket("udp4", "0.0.0.0")
// ListenPacket("udp6", "fe80::1%en0")
@@ -38,6 +39,7 @@
// followed by a colon and an ICMP protocol number or name.
//
// Examples:
+//
// ListenPacket("ip4:icmp", "192.168.0.1")
// ListenPacket("ip4:1", "0.0.0.0")
// ListenPacket("ip6:ipv6-icmp", "fe80::1%en0")
diff --git a/icmp/listen_stub.go b/icmp/listen_stub.go
index bc9343c..1acfb74 100644
--- a/icmp/listen_stub.go
+++ b/icmp/listen_stub.go
@@ -16,6 +16,7 @@
// Currently only Darwin and Linux support this.
//
// Examples:
+//
// ListenPacket("udp4", "192.168.0.1")
// ListenPacket("udp4", "0.0.0.0")
// ListenPacket("udp6", "fe80::1%en0")
@@ -25,6 +26,7 @@
// followed by a colon and an ICMP protocol number or name.
//
// Examples:
+//
// ListenPacket("ip4:icmp", "192.168.0.1")
// ListenPacket("ip4:1", "0.0.0.0")
// ListenPacket("ip6:ipv6-icmp", "fe80::1%en0")
diff --git a/idna/trieval.go b/idna/trieval.go
index 7a8cf88..9c070a4 100644
--- a/idna/trieval.go
+++ b/idna/trieval.go
diff --git a/internal/socket/zsys_linux_ppc.go b/internal/socket/zsys_linux_ppc.go
index 59b71da..4c19269 100644
--- a/internal/socket/zsys_linux_ppc.go
+++ b/internal/socket/zsys_linux_ppc.go
@@ -4,32 +4,32 @@
package socket
type iovec struct {
- Base *byte
- Len uint32
+ Base *byte
+ Len uint32
}
type msghdr struct {
- Name *byte
- Namelen uint32
- Iov *iovec
- Iovlen uint32
- Control *byte
- Controllen uint32
- Flags int32
+ Name *byte
+ Namelen uint32
+ Iov *iovec
+ Iovlen uint32
+ Control *byte
+ Controllen uint32
+ Flags int32
}
type mmsghdr struct {
- Hdr msghdr
- Len uint32
+ Hdr msghdr
+ Len uint32
}
type cmsghdr struct {
- Len uint32
- Level int32
- Type int32
+ Len uint32
+ Level int32
+ Type int32
}
const (
- sizeofIovec = 0x8
- sizeofMsghdr = 0x1c
+ sizeofIovec = 0x8
+ sizeofMsghdr = 0x1c
)
diff --git a/ipv4/doc.go b/ipv4/doc.go
index 2458349..6fbdc52 100644
--- a/ipv4/doc.go
+++ b/ipv4/doc.go
@@ -16,8 +16,7 @@
// 3376.
// Source-specific multicast is defined in RFC 4607.
//
-//
-// Unicasting
+// # Unicasting
//
// The options for unicasting are available for net.TCPConn,
// net.UDPConn and net.IPConn which are created as network connections
@@ -51,8 +50,7 @@
// }(c)
// }
//
-//
-// Multicasting
+// # Multicasting
//
// The options for multicasting are available for net.UDPConn and
// net.IPConn which are created as network connections that use the
@@ -141,8 +139,7 @@
// }
// }
//
-//
-// More multicasting
+// # More multicasting
//
// An application that uses PacketConn or RawConn may join multiple
// multicast groups. For example, a UDP listener with port 1024 might
@@ -200,8 +197,7 @@
// // error handling
// }
//
-//
-// Source-specific multicasting
+// # Source-specific multicasting
//
// An application that uses PacketConn or RawConn on IGMPv3 supported
// platform is able to join source-specific multicast groups.
diff --git a/ipv6/doc.go b/ipv6/doc.go
index e0be9d5..2148b81 100644
--- a/ipv6/doc.go
+++ b/ipv6/doc.go
@@ -17,8 +17,7 @@
// On Darwin, this package requires OS X Mavericks version 10.9 or
// above, or equivalent.
//
-//
-// Unicasting
+// # Unicasting
//
// The options for unicasting are available for net.TCPConn,
// net.UDPConn and net.IPConn which are created as network connections
@@ -52,8 +51,7 @@
// }(c)
// }
//
-//
-// Multicasting
+// # Multicasting
//
// The options for multicasting are available for net.UDPConn and
// net.IPConn which are created as network connections that use the
@@ -140,8 +138,7 @@
// }
// }
//
-//
-// More multicasting
+// # More multicasting
//
// An application that uses PacketConn may join multiple multicast
// groups. For example, a UDP listener with port 1024 might join two
@@ -199,8 +196,7 @@
// // error handling
// }
//
-//
-// Source-specific multicasting
+// # Source-specific multicasting
//
// An application that uses PacketConn on MLDv2 supported platform is
// able to join source-specific multicast groups.
diff --git a/publicsuffix/list.go b/publicsuffix/list.go
index 200617e..e2fddd6 100644
--- a/publicsuffix/list.go
+++ b/publicsuffix/list.go
@@ -33,9 +33,10 @@
// the last two are not (but share the same eTLD+1: "google.com").
//
// All of these domains have the same eTLD+1:
-// - "www.books.amazon.co.uk"
-// - "books.amazon.co.uk"
-// - "amazon.co.uk"
+// - "www.books.amazon.co.uk"
+// - "books.amazon.co.uk"
+// - "amazon.co.uk"
+//
// Specifically, the eTLD+1 is "amazon.co.uk", because the eTLD is "co.uk".
//
// There is no closed form algorithm to calculate the eTLD of a domain.
diff --git a/publicsuffix/table.go b/publicsuffix/table.go
index fd3c3ca..a444239 100644
--- a/publicsuffix/table.go
+++ b/publicsuffix/table.go
@@ -540,6 +540,7 @@
// An I denotes an ICANN domain.
//
// The layout within the uint32, from MSB to LSB, is:
+//
// [ 0 bits] unused
// [10 bits] children index
// [ 1 bits] ICANN bit
@@ -9898,6 +9899,7 @@
// will be in the range [0, 6), depending on the wildcard bit and node type.
//
// The layout within the uint32, from MSB to LSB, is:
+//
// [ 1 bits] unused
// [ 1 bits] wildcard bit
// [ 2 bits] node type
diff --git a/webdav/file.go b/webdav/file.go
index 3fcc053..c48a17e 100644
--- a/webdav/file.go
+++ b/webdav/file.go
@@ -163,6 +163,7 @@
// - "/", "foo", false
// - "/foo/", "bar", false
// - "/foo/bar/", "x", true
+//
// The frag argument will be empty only if dir is the root node and the walk
// ends at that root node.
func (fs *memFS) walk(op, fullname string, f func(dir *memFSNode, frag string, final bool) error) error {
diff --git a/webdav/internal/xml/marshal.go b/webdav/internal/xml/marshal.go
index cb82ec2..4dd0f41 100644
--- a/webdav/internal/xml/marshal.go
+++ b/webdav/internal/xml/marshal.go
@@ -32,33 +32,33 @@
// elements containing the data.
//
// The name for the XML elements is taken from, in order of preference:
-// - the tag on the XMLName field, if the data is a struct
-// - the value of the XMLName field of type xml.Name
-// - the tag of the struct field used to obtain the data
-// - the name of the struct field used to obtain the data
-// - the name of the marshalled type
+// - the tag on the XMLName field, if the data is a struct
+// - the value of the XMLName field of type xml.Name
+// - the tag of the struct field used to obtain the data
+// - the name of the struct field used to obtain the data
+// - the name of the marshalled type
//
// The XML element for a struct contains marshalled elements for each of the
// exported fields of the struct, with these exceptions:
-// - the XMLName field, described above, is omitted.
-// - a field with tag "-" is omitted.
-// - a field with tag "name,attr" becomes an attribute with
-// the given name in the XML element.
-// - a field with tag ",attr" becomes an attribute with the
-// field name in the XML element.
-// - a field with tag ",chardata" is written as character data,
-// not as an XML element.
-// - a field with tag ",innerxml" is written verbatim, not subject
-// to the usual marshalling procedure.
-// - a field with tag ",comment" is written as an XML comment, not
-// subject to the usual marshalling procedure. It must not contain
-// the "--" string within it.
-// - a field with a tag including the "omitempty" option is omitted
-// if the field value is empty. The empty values are false, 0, any
-// nil pointer or interface value, and any array, slice, map, or
-// string of length zero.
-// - an anonymous struct field is handled as if the fields of its
-// value were part of the outer struct.
+// - the XMLName field, described above, is omitted.
+// - a field with tag "-" is omitted.
+// - a field with tag "name,attr" becomes an attribute with
+// the given name in the XML element.
+// - a field with tag ",attr" becomes an attribute with the
+// field name in the XML element.
+// - a field with tag ",chardata" is written as character data,
+// not as an XML element.
+// - a field with tag ",innerxml" is written verbatim, not subject
+// to the usual marshalling procedure.
+// - a field with tag ",comment" is written as an XML comment, not
+// subject to the usual marshalling procedure. It must not contain
+// the "--" string within it.
+// - a field with a tag including the "omitempty" option is omitted
+// if the field value is empty. The empty values are false, 0, any
+// nil pointer or interface value, and any array, slice, map, or
+// string of length zero.
+// - an anonymous struct field is handled as if the fields of its
+// value were part of the outer struct.
//
// If a field uses a tag "a>b>c", then the element c will be nested inside
// parent elements a and b. Fields that appear next to each other that name
diff --git a/webdav/internal/xml/read.go b/webdav/internal/xml/read.go
index 4089056..bfaef6f 100644
--- a/webdav/internal/xml/read.go
+++ b/webdav/internal/xml/read.go
@@ -35,57 +35,57 @@
// In the rules, the tag of a field refers to the value associated with the
// key 'xml' in the struct field's tag (see the example above).
//
-// * If the struct has a field of type []byte or string with tag
-// ",innerxml", Unmarshal accumulates the raw XML nested inside the
-// element in that field. The rest of the rules still apply.
+// - If the struct has a field of type []byte or string with tag
+// ",innerxml", Unmarshal accumulates the raw XML nested inside the
+// element in that field. The rest of the rules still apply.
//
-// * If the struct has a field named XMLName of type xml.Name,
-// Unmarshal records the element name in that field.
+// - If the struct has a field named XMLName of type xml.Name,
+// Unmarshal records the element name in that field.
//
-// * If the XMLName field has an associated tag of the form
-// "name" or "namespace-URL name", the XML element must have
-// the given name (and, optionally, name space) or else Unmarshal
-// returns an error.
+// - If the XMLName field has an associated tag of the form
+// "name" or "namespace-URL name", the XML element must have
+// the given name (and, optionally, name space) or else Unmarshal
+// returns an error.
//
-// * If the XML element has an attribute whose name matches a
-// struct field name with an associated tag containing ",attr" or
-// the explicit name in a struct field tag of the form "name,attr",
-// Unmarshal records the attribute value in that field.
+// - If the XML element has an attribute whose name matches a
+// struct field name with an associated tag containing ",attr" or
+// the explicit name in a struct field tag of the form "name,attr",
+// Unmarshal records the attribute value in that field.
//
-// * If the XML element contains character data, that data is
-// accumulated in the first struct field that has tag ",chardata".
-// The struct field may have type []byte or string.
-// If there is no such field, the character data is discarded.
+// - If the XML element contains character data, that data is
+// accumulated in the first struct field that has tag ",chardata".
+// The struct field may have type []byte or string.
+// If there is no such field, the character data is discarded.
//
-// * If the XML element contains comments, they are accumulated in
-// the first struct field that has tag ",comment". The struct
-// field may have type []byte or string. If there is no such
-// field, the comments are discarded.
+// - If the XML element contains comments, they are accumulated in
+// the first struct field that has tag ",comment". The struct
+// field may have type []byte or string. If there is no such
+// field, the comments are discarded.
//
-// * If the XML element contains a sub-element whose name matches
-// the prefix of a tag formatted as "a" or "a>b>c", unmarshal
-// will descend into the XML structure looking for elements with the
-// given names, and will map the innermost elements to that struct
-// field. A tag starting with ">" is equivalent to one starting
-// with the field name followed by ">".
+// - If the XML element contains a sub-element whose name matches
+// the prefix of a tag formatted as "a" or "a>b>c", unmarshal
+// will descend into the XML structure looking for elements with the
+// given names, and will map the innermost elements to that struct
+// field. A tag starting with ">" is equivalent to one starting
+// with the field name followed by ">".
//
-// * If the XML element contains a sub-element whose name matches
-// a struct field's XMLName tag and the struct field has no
-// explicit name tag as per the previous rule, unmarshal maps
-// the sub-element to that struct field.
+// - If the XML element contains a sub-element whose name matches
+// a struct field's XMLName tag and the struct field has no
+// explicit name tag as per the previous rule, unmarshal maps
+// the sub-element to that struct field.
//
-// * If the XML element contains a sub-element whose name matches a
-// field without any mode flags (",attr", ",chardata", etc), Unmarshal
-// maps the sub-element to that struct field.
+// - If the XML element contains a sub-element whose name matches a
+// field without any mode flags (",attr", ",chardata", etc), Unmarshal
+// maps the sub-element to that struct field.
//
-// * If the XML element contains a sub-element that hasn't matched any
-// of the above rules and the struct has a field with tag ",any",
-// unmarshal maps the sub-element to that struct field.
+// - If the XML element contains a sub-element that hasn't matched any
+// of the above rules and the struct has a field with tag ",any",
+// unmarshal maps the sub-element to that struct field.
//
-// * An anonymous struct field is handled as if the fields of its
-// value were part of the outer struct.
+// - An anonymous struct field is handled as if the fields of its
+// value were part of the outer struct.
//
-// * A struct field with tag "-" is never unmarshalled into.
+// - A struct field with tag "-" is never unmarshalled into.
//
// Unmarshal maps an XML element to a string or []byte by saving the
// concatenation of that element's character data in the string or
@@ -110,7 +110,6 @@
//
// Unmarshal maps an XML element to a pointer by setting the pointer
// to a freshly allocated value and then mapping the element to that value.
-//
func Unmarshal(data []byte, v interface{}) error {
return NewDecoder(bytes.NewReader(data)).Decode(v)
}
diff --git a/webdav/lock_test.go b/webdav/lock_test.go
index 561ada4..e7fe970 100644
--- a/webdav/lock_test.go
+++ b/webdav/lock_test.go
@@ -68,9 +68,9 @@
// lockTestNames are the names of a set of mutually compatible locks. For each
// name fragment:
-// - _ means no explicit lock.
-// - i means an infinite-depth lock,
-// - z means a zero-depth lock,
+// - _ means no explicit lock.
+// - i means an infinite-depth lock,
+// - z means a zero-depth lock,
var lockTestNames = []string{
"/_/_/_/_/z",
"/_/_/i",
diff --git a/webdav/webdav.go b/webdav/webdav.go
index d88995f..32f5b65 100644
--- a/webdav/webdav.go
+++ b/webdav/webdav.go
@@ -642,10 +642,11 @@
// infiniteDepth. Parsing any other string returns invalidDepth.
//
// Different WebDAV methods have further constraints on valid depths:
-// - PROPFIND has no further restrictions, as per section 9.1.
-// - COPY accepts only "0" or "infinity", as per section 9.8.3.
-// - MOVE accepts only "infinity", as per section 9.9.2.
-// - LOCK accepts only "0" or "infinity", as per section 9.10.3.
+// - PROPFIND has no further restrictions, as per section 9.1.
+// - COPY accepts only "0" or "infinity", as per section 9.8.3.
+// - MOVE accepts only "infinity", as per section 9.9.2.
+// - LOCK accepts only "0" or "infinity", as per section 9.10.3.
+//
// These constraints are enforced by the handleXxx methods.
func parseDepth(s string) int {
switch s {
diff --git a/webdav/xml_test.go b/webdav/xml_test.go
index a3d9e1e..ac2f247 100644
--- a/webdav/xml_test.go
+++ b/webdav/xml_test.go
@@ -827,15 +827,14 @@
// normalize writes the normalized XML content of r to w. It applies the
// following rules
//
-// * Rename namespace prefixes according to an internal heuristic.
-// * Remove unnecessary namespace declarations.
-// * Sort attributes in XML start elements in lexical order of their
-// fully qualified name.
-// * Remove XML directives and processing instructions.
-// * Remove CDATA between XML tags that only contains whitespace, if
-// instructed to do so.
-// * Remove comments, if instructed to do so.
-//
+// - Rename namespace prefixes according to an internal heuristic.
+// - Remove unnecessary namespace declarations.
+// - Sort attributes in XML start elements in lexical order of their
+// fully qualified name.
+// - Remove XML directives and processing instructions.
+// - Remove CDATA between XML tags that only contains whitespace, if
+// instructed to do so.
+// - Remove comments, if instructed to do so.
func (n *xmlNormalizer) normalize(w io.Writer, r io.Reader) error {
d := ixml.NewDecoder(r)
e := ixml.NewEncoder(w)
diff --git a/websocket/websocket.go b/websocket/websocket.go
index 6c45c73..ea422e1 100644
--- a/websocket/websocket.go
+++ b/websocket/websocket.go
@@ -8,8 +8,8 @@
// This package currently lacks some features found in alternative
// and more actively maintained WebSocket packages:
//
-// https://godoc.org/github.com/gorilla/websocket
-// https://godoc.org/nhooyr.io/websocket
+// https://godoc.org/github.com/gorilla/websocket
+// https://godoc.org/nhooyr.io/websocket
package websocket // import "golang.org/x/net/websocket"
import (
@@ -416,7 +416,6 @@
// send binary frame
data = []byte{0, 1, 2}
websocket.Message.Send(ws, data)
-
*/
var Message = Codec{marshal, unmarshal}
To view, visit change 399599. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: cmd/webp-manual-test/main.go
Insertions: 0, Deletions: 1.
@@ -5,7 +5,6 @@
//go:build ignore
// +build ignore
-//
// This build tag means that "go install golang.org/x/image/..." doesn't
// install this manual test. Use "go run main.go" to explicitly run it.
```
```
The name of the file: example/font/main.go
Insertions: 0, Deletions: 1.
@@ -5,7 +5,6 @@
//go:build example
// +build example
-//
// This build tag means that "go install golang.org/x/image/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
// -tags=example" to install it.
```
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Iae65e4d8854b66205e4cbcdd1ae0eec48c582496
Reviewed-on: https://go-review.googlesource.com/c/image/+/399615
Run-TryBot: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
---
M ccitt/gen.go
M ccitt/table.go
M cmd/webp-manual-test/main.go
M draw/scale.go
M example/font/main.go
M font/gofont/gen.go
M font/sfnt/gpos.go
M font/sfnt/proprietary_test.go
M tiff/lzw/reader.go
M vector/acc_test.go
M vector/raster_fixed.go
11 files changed, 487 insertions(+), 459 deletions(-)
diff --git a/ccitt/gen.go b/ccitt/gen.go
index 6f37e76..bf8aa7f 100644
--- a/ccitt/gen.go
+++ b/ccitt/gen.go
@@ -224,9 +224,9 @@
writeComment(w, n.children[0], prefixUp, false)
defer writeComment(w, n.children[1], prefixDown, true)
- fmt.Fprintf(w, "// b%03d ", n.branchIndex)
+ fmt.Fprintf(w, "//\tb%03d ", n.branchIndex)
} else {
- fmt.Fprintf(w, "// ")
+ fmt.Fprintf(w, "//\t ")
}
w.WriteString(prefix[:len(prefix)-2])
diff --git a/ccitt/table.go b/ccitt/table.go
index ef7ea9d..8b3794b 100644
--- a/ccitt/table.go
+++ b/ccitt/table.go
@@ -31,27 +31,27 @@
// modeDecodeTable represents Table 1 and the End-of-Line code.
//
-// +=XXXXX
-// b009 +-+
-// | +=v0009
-// b007 +-+
-// | | +=v0008
-// b010 | +-+
-// | +=v0005
-// b006 +-+
-// | | +=v0007
-// b008 | +-+
-// | +=v0004
-// b005 +-+
-// | +=v0000
-// b003 +-+
-// | +=v0001
-// b002 +-+
-// | | +=v0006
-// b004 | +-+
-// | +=v0003
-// b001 +-+
-// +=v0002
+// +=XXXXX
+// b009 +-+
+// | +=v0009
+// b007 +-+
+// | | +=v0008
+// b010 | +-+
+// | +=v0005
+// b006 +-+
+// | | +=v0007
+// b008 | +-+
+// | +=v0004
+// b005 +-+
+// | +=v0000
+// b003 +-+
+// | +=v0001
+// b002 +-+
+// | | +=v0006
+// b004 | +-+
+// | +=v0003
+// b001 +-+
+// +=v0002
var modeDecodeTable = [...][2]int16{
0: {0, 0},
1: {2, ^2},
@@ -68,215 +68,215 @@
// whiteDecodeTable represents Tables 2 and 3 for a white run.
//
-// +=XXXXX
-// b059 +-+
-// | | +=v1792
-// b096 | | +-+
-// | | | | +=v1984
-// b100 | | | +-+
-// | | | +=v2048
-// b094 | | +-+
-// | | | | +=v2112
-// b101 | | | | +-+
-// | | | | | +=v2176
-// b097 | | | +-+
-// | | | | +=v2240
-// b102 | | | +-+
-// | | | +=v2304
-// b085 | +-+
-// | | +=v1856
-// b098 | | +-+
-// | | | +=v1920
-// b095 | +-+
-// | | +=v2368
-// b103 | | +-+
-// | | | +=v2432
-// b099 | +-+
-// | | +=v2496
-// b104 | +-+
-// | +=v2560
-// b040 +-+
-// | | +=v0029
-// b060 | +-+
-// | +=v0030
-// b026 +-+
-// | | +=v0045
-// b061 | | +-+
-// | | | +=v0046
-// b041 | +-+
-// | +=v0022
-// b016 +-+
-// | | +=v0023
-// b042 | | +-+
-// | | | | +=v0047
-// b062 | | | +-+
-// | | | +=v0048
-// b027 | +-+
-// | +=v0013
-// b008 +-+
-// | | +=v0020
-// b043 | | +-+
-// | | | | +=v0033
-// b063 | | | +-+
-// | | | +=v0034
-// b028 | | +-+
-// | | | | +=v0035
-// b064 | | | | +-+
-// | | | | | +=v0036
-// b044 | | | +-+
-// | | | | +=v0037
-// b065 | | | +-+
-// | | | +=v0038
-// b017 | +-+
-// | | +=v0019
-// b045 | | +-+
-// | | | | +=v0031
-// b066 | | | +-+
-// | | | +=v0032
-// b029 | +-+
-// | +=v0001
-// b004 +-+
-// | | +=v0012
-// b030 | | +-+
-// | | | | +=v0053
-// b067 | | | | +-+
-// | | | | | +=v0054
-// b046 | | | +-+
-// | | | +=v0026
-// b018 | | +-+
-// | | | | +=v0039
-// b068 | | | | +-+
-// | | | | | +=v0040
-// b047 | | | | +-+
-// | | | | | | +=v0041
-// b069 | | | | | +-+
-// | | | | | +=v0042
-// b031 | | | +-+
-// | | | | +=v0043
-// b070 | | | | +-+
-// | | | | | +=v0044
-// b048 | | | +-+
-// | | | +=v0021
-// b009 | +-+
-// | | +=v0028
-// b049 | | +-+
-// | | | | +=v0061
-// b071 | | | +-+
-// | | | +=v0062
-// b032 | | +-+
-// | | | | +=v0063
-// b072 | | | | +-+
-// | | | | | +=v0000
-// b050 | | | +-+
-// | | | | +=v0320
-// b073 | | | +-+
-// | | | +=v0384
-// b019 | +-+
-// | +=v0010
-// b002 +-+
-// | | +=v0011
-// b020 | | +-+
-// | | | | +=v0027
-// b051 | | | | +-+
-// | | | | | | +=v0059
-// b074 | | | | | +-+
-// | | | | | +=v0060
-// b033 | | | +-+
-// | | | | +=v1472
-// b086 | | | | +-+
-// | | | | | +=v1536
-// b075 | | | | +-+
-// | | | | | | +=v1600
-// b087 | | | | | +-+
-// | | | | | +=v1728
-// b052 | | | +-+
-// | | | +=v0018
-// b010 | | +-+
-// | | | | +=v0024
-// b053 | | | | +-+
-// | | | | | | +=v0049
-// b076 | | | | | +-+
-// | | | | | +=v0050
-// b034 | | | | +-+
-// | | | | | | +=v0051
-// b077 | | | | | | +-+
-// | | | | | | | +=v0052
-// b054 | | | | | +-+
-// | | | | | +=v0025
-// b021 | | | +-+
-// | | | | +=v0055
-// b078 | | | | +-+
-// | | | | | +=v0056
-// b055 | | | | +-+
-// | | | | | | +=v0057
-// b079 | | | | | +-+
-// | | | | | +=v0058
-// b035 | | | +-+
-// | | | +=v0192
-// b005 | +-+
-// | | +=v1664
-// b036 | | +-+
-// | | | | +=v0448
-// b080 | | | | +-+
-// | | | | | +=v0512
-// b056 | | | +-+
-// | | | | +=v0704
-// b088 | | | | +-+
-// | | | | | +=v0768
-// b081 | | | +-+
-// | | | +=v0640
-// b022 | | +-+
-// | | | | +=v0576
-// b082 | | | | +-+
-// | | | | | | +=v0832
-// b089 | | | | | +-+
-// | | | | | +=v0896
-// b057 | | | | +-+
-// | | | | | | +=v0960
-// b090 | | | | | | +-+
-// | | | | | | | +=v1024
-// b083 | | | | | +-+
-// | | | | | | +=v1088
-// b091 | | | | | +-+
-// | | | | | +=v1152
-// b037 | | | +-+
-// | | | | +=v1216
-// b092 | | | | +-+
-// | | | | | +=v1280
-// b084 | | | | +-+
-// | | | | | | +=v1344
-// b093 | | | | | +-+
-// | | | | | +=v1408
-// b058 | | | +-+
-// | | | +=v0256
-// b011 | +-+
-// | +=v0002
-// b001 +-+
-// | +=v0003
-// b012 | +-+
-// | | | +=v0128
-// b023 | | +-+
-// | | +=v0008
-// b006 | +-+
-// | | | +=v0009
-// b024 | | | +-+
-// | | | | | +=v0016
-// b038 | | | | +-+
-// | | | | +=v0017
-// b013 | | +-+
-// | | +=v0004
-// b003 +-+
-// | +=v0005
-// b014 | +-+
-// | | | +=v0014
-// b039 | | | +-+
-// | | | | +=v0015
-// b025 | | +-+
-// | | +=v0064
-// b007 +-+
-// | +=v0006
-// b015 +-+
-// +=v0007
+// +=XXXXX
+// b059 +-+
+// | | +=v1792
+// b096 | | +-+
+// | | | | +=v1984
+// b100 | | | +-+
+// | | | +=v2048
+// b094 | | +-+
+// | | | | +=v2112
+// b101 | | | | +-+
+// | | | | | +=v2176
+// b097 | | | +-+
+// | | | | +=v2240
+// b102 | | | +-+
+// | | | +=v2304
+// b085 | +-+
+// | | +=v1856
+// b098 | | +-+
+// | | | +=v1920
+// b095 | +-+
+// | | +=v2368
+// b103 | | +-+
+// | | | +=v2432
+// b099 | +-+
+// | | +=v2496
+// b104 | +-+
+// | +=v2560
+// b040 +-+
+// | | +=v0029
+// b060 | +-+
+// | +=v0030
+// b026 +-+
+// | | +=v0045
+// b061 | | +-+
+// | | | +=v0046
+// b041 | +-+
+// | +=v0022
+// b016 +-+
+// | | +=v0023
+// b042 | | +-+
+// | | | | +=v0047
+// b062 | | | +-+
+// | | | +=v0048
+// b027 | +-+
+// | +=v0013
+// b008 +-+
+// | | +=v0020
+// b043 | | +-+
+// | | | | +=v0033
+// b063 | | | +-+
+// | | | +=v0034
+// b028 | | +-+
+// | | | | +=v0035
+// b064 | | | | +-+
+// | | | | | +=v0036
+// b044 | | | +-+
+// | | | | +=v0037
+// b065 | | | +-+
+// | | | +=v0038
+// b017 | +-+
+// | | +=v0019
+// b045 | | +-+
+// | | | | +=v0031
+// b066 | | | +-+
+// | | | +=v0032
+// b029 | +-+
+// | +=v0001
+// b004 +-+
+// | | +=v0012
+// b030 | | +-+
+// | | | | +=v0053
+// b067 | | | | +-+
+// | | | | | +=v0054
+// b046 | | | +-+
+// | | | +=v0026
+// b018 | | +-+
+// | | | | +=v0039
+// b068 | | | | +-+
+// | | | | | +=v0040
+// b047 | | | | +-+
+// | | | | | | +=v0041
+// b069 | | | | | +-+
+// | | | | | +=v0042
+// b031 | | | +-+
+// | | | | +=v0043
+// b070 | | | | +-+
+// | | | | | +=v0044
+// b048 | | | +-+
+// | | | +=v0021
+// b009 | +-+
+// | | +=v0028
+// b049 | | +-+
+// | | | | +=v0061
+// b071 | | | +-+
+// | | | +=v0062
+// b032 | | +-+
+// | | | | +=v0063
+// b072 | | | | +-+
+// | | | | | +=v0000
+// b050 | | | +-+
+// | | | | +=v0320
+// b073 | | | +-+
+// | | | +=v0384
+// b019 | +-+
+// | +=v0010
+// b002 +-+
+// | | +=v0011
+// b020 | | +-+
+// | | | | +=v0027
+// b051 | | | | +-+
+// | | | | | | +=v0059
+// b074 | | | | | +-+
+// | | | | | +=v0060
+// b033 | | | +-+
+// | | | | +=v1472
+// b086 | | | | +-+
+// | | | | | +=v1536
+// b075 | | | | +-+
+// | | | | | | +=v1600
+// b087 | | | | | +-+
+// | | | | | +=v1728
+// b052 | | | +-+
+// | | | +=v0018
+// b010 | | +-+
+// | | | | +=v0024
+// b053 | | | | +-+
+// | | | | | | +=v0049
+// b076 | | | | | +-+
+// | | | | | +=v0050
+// b034 | | | | +-+
+// | | | | | | +=v0051
+// b077 | | | | | | +-+
+// | | | | | | | +=v0052
+// b054 | | | | | +-+
+// | | | | | +=v0025
+// b021 | | | +-+
+// | | | | +=v0055
+// b078 | | | | +-+
+// | | | | | +=v0056
+// b055 | | | | +-+
+// | | | | | | +=v0057
+// b079 | | | | | +-+
+// | | | | | +=v0058
+// b035 | | | +-+
+// | | | +=v0192
+// b005 | +-+
+// | | +=v1664
+// b036 | | +-+
+// | | | | +=v0448
+// b080 | | | | +-+
+// | | | | | +=v0512
+// b056 | | | +-+
+// | | | | +=v0704
+// b088 | | | | +-+
+// | | | | | +=v0768
+// b081 | | | +-+
+// | | | +=v0640
+// b022 | | +-+
+// | | | | +=v0576
+// b082 | | | | +-+
+// | | | | | | +=v0832
+// b089 | | | | | +-+
+// | | | | | +=v0896
+// b057 | | | | +-+
+// | | | | | | +=v0960
+// b090 | | | | | | +-+
+// | | | | | | | +=v1024
+// b083 | | | | | +-+
+// | | | | | | +=v1088
+// b091 | | | | | +-+
+// | | | | | +=v1152
+// b037 | | | +-+
+// | | | | +=v1216
+// b092 | | | | +-+
+// | | | | | +=v1280
+// b084 | | | | +-+
+// | | | | | | +=v1344
+// b093 | | | | | +-+
+// | | | | | +=v1408
+// b058 | | | +-+
+// | | | +=v0256
+// b011 | +-+
+// | +=v0002
+// b001 +-+
+// | +=v0003
+// b012 | +-+
+// | | | +=v0128
+// b023 | | +-+
+// | | +=v0008
+// b006 | +-+
+// | | | +=v0009
+// b024 | | | +-+
+// | | | | | +=v0016
+// b038 | | | | +-+
+// | | | | +=v0017
+// b013 | | +-+
+// | | +=v0004
+// b003 +-+
+// | +=v0005
+// b014 | +-+
+// | | | +=v0014
+// b039 | | | +-+
+// | | | | +=v0015
+// b025 | | +-+
+// | | +=v0064
+// b007 +-+
+// | +=v0006
+// b015 +-+
+// +=v0007
var whiteDecodeTable = [...][2]int16{
0: {0, 0},
1: {2, 3},
@@ -387,215 +387,215 @@
// blackDecodeTable represents Tables 2 and 3 for a black run.
//
-// +=XXXXX
-// b017 +-+
-// | | +=v1792
-// b042 | | +-+
-// | | | | +=v1984
-// b063 | | | +-+
-// | | | +=v2048
-// b029 | | +-+
-// | | | | +=v2112
-// b064 | | | | +-+
-// | | | | | +=v2176
-// b043 | | | +-+
-// | | | | +=v2240
-// b065 | | | +-+
-// | | | +=v2304
-// b022 | +-+
-// | | +=v1856
-// b044 | | +-+
-// | | | +=v1920
-// b030 | +-+
-// | | +=v2368
-// b066 | | +-+
-// | | | +=v2432
-// b045 | +-+
-// | | +=v2496
-// b067 | +-+
-// | +=v2560
-// b013 +-+
-// | | +=v0018
-// b031 | | +-+
-// | | | | +=v0052
-// b068 | | | | +-+
-// | | | | | | +=v0640
-// b095 | | | | | +-+
-// | | | | | +=v0704
-// b046 | | | +-+
-// | | | | +=v0768
-// b096 | | | | +-+
-// | | | | | +=v0832
-// b069 | | | +-+
-// | | | +=v0055
-// b023 | | +-+
-// | | | | +=v0056
-// b070 | | | | +-+
-// | | | | | | +=v1280
-// b097 | | | | | +-+
-// | | | | | +=v1344
-// b047 | | | | +-+
-// | | | | | | +=v1408
-// b098 | | | | | | +-+
-// | | | | | | | +=v1472
-// b071 | | | | | +-+
-// | | | | | +=v0059
-// b032 | | | +-+
-// | | | | +=v0060
-// b072 | | | | +-+
-// | | | | | | +=v1536
-// b099 | | | | | +-+
-// | | | | | +=v1600
-// b048 | | | +-+
-// | | | +=v0024
-// b018 | +-+
-// | | +=v0025
-// b049 | | +-+
-// | | | | +=v1664
-// b100 | | | | +-+
-// | | | | | +=v1728
-// b073 | | | +-+
-// | | | +=v0320
-// b033 | | +-+
-// | | | | +=v0384
-// b074 | | | | +-+
-// | | | | | +=v0448
-// b050 | | | +-+
-// | | | | +=v0512
-// b101 | | | | +-+
-// | | | | | +=v0576
-// b075 | | | +-+
-// | | | +=v0053
-// b024 | +-+
-// | | +=v0054
-// b076 | | +-+
-// | | | | +=v0896
-// b102 | | | +-+
-// | | | +=v0960
-// b051 | | +-+
-// | | | | +=v1024
-// b103 | | | | +-+
-// | | | | | +=v1088
-// b077 | | | +-+
-// | | | | +=v1152
-// b104 | | | +-+
-// | | | +=v1216
-// b034 | +-+
-// | +=v0064
-// b010 +-+
-// | | +=v0013
-// b019 | | +-+
-// | | | | +=v0023
-// b052 | | | | +-+
-// | | | | | | +=v0050
-// b078 | | | | | +-+
-// | | | | | +=v0051
-// b035 | | | | +-+
-// | | | | | | +=v0044
-// b079 | | | | | | +-+
-// | | | | | | | +=v0045
-// b053 | | | | | +-+
-// | | | | | | +=v0046
-// b080 | | | | | +-+
-// | | | | | +=v0047
-// b025 | | | +-+
-// | | | | +=v0057
-// b081 | | | | +-+
-// | | | | | +=v0058
-// b054 | | | | +-+
-// | | | | | | +=v0061
-// b082 | | | | | +-+
-// | | | | | +=v0256
-// b036 | | | +-+
-// | | | +=v0016
-// b014 | +-+
-// | | +=v0017
-// b037 | | +-+
-// | | | | +=v0048
-// b083 | | | | +-+
-// | | | | | +=v0049
-// b055 | | | +-+
-// | | | | +=v0062
-// b084 | | | +-+
-// | | | +=v0063
-// b026 | | +-+
-// | | | | +=v0030
-// b085 | | | | +-+
-// | | | | | +=v0031
-// b056 | | | | +-+
-// | | | | | | +=v0032
-// b086 | | | | | +-+
-// | | | | | +=v0033
-// b038 | | | +-+
-// | | | | +=v0040
-// b087 | | | | +-+
-// | | | | | +=v0041
-// b057 | | | +-+
-// | | | +=v0022
-// b020 | +-+
-// | +=v0014
-// b008 +-+
-// | | +=v0010
-// b015 | | +-+
-// | | | +=v0011
-// b011 | +-+
-// | | +=v0015
-// b027 | | +-+
-// | | | | +=v0128
-// b088 | | | | +-+
-// | | | | | +=v0192
-// b058 | | | | +-+
-// | | | | | | +=v0026
-// b089 | | | | | +-+
-// | | | | | +=v0027
-// b039 | | | +-+
-// | | | | +=v0028
-// b090 | | | | +-+
-// | | | | | +=v0029
-// b059 | | | +-+
-// | | | +=v0019
-// b021 | | +-+
-// | | | | +=v0020
-// b060 | | | | +-+
-// | | | | | | +=v0034
-// b091 | | | | | +-+
-// | | | | | +=v0035
-// b040 | | | | +-+
-// | | | | | | +=v0036
-// b092 | | | | | | +-+
-// | | | | | | | +=v0037
-// b061 | | | | | +-+
-// | | | | | | +=v0038
-// b093 | | | | | +-+
-// | | | | | +=v0039
-// b028 | | | +-+
-// | | | | +=v0021
-// b062 | | | | +-+
-// | | | | | | +=v0042
-// b094 | | | | | +-+
-// | | | | | +=v0043
-// b041 | | | +-+
-// | | | +=v0000
-// b016 | +-+
-// | +=v0012
-// b006 +-+
-// | | +=v0009
-// b012 | | +-+
-// | | | +=v0008
-// b009 | +-+
-// | +=v0007
-// b004 +-+
-// | | +=v0006
-// b007 | +-+
-// | +=v0005
-// b002 +-+
-// | | +=v0001
-// b005 | +-+
-// | +=v0004
-// b001 +-+
-// | +=v0003
-// b003 +-+
-// +=v0002
+// +=XXXXX
+// b017 +-+
+// | | +=v1792
+// b042 | | +-+
+// | | | | +=v1984
+// b063 | | | +-+
+// | | | +=v2048
+// b029 | | +-+
+// | | | | +=v2112
+// b064 | | | | +-+
+// | | | | | +=v2176
+// b043 | | | +-+
+// | | | | +=v2240
+// b065 | | | +-+
+// | | | +=v2304
+// b022 | +-+
+// | | +=v1856
+// b044 | | +-+
+// | | | +=v1920
+// b030 | +-+
+// | | +=v2368
+// b066 | | +-+
+// | | | +=v2432
+// b045 | +-+
+// | | +=v2496
+// b067 | +-+
+// | +=v2560
+// b013 +-+
+// | | +=v0018
+// b031 | | +-+
+// | | | | +=v0052
+// b068 | | | | +-+
+// | | | | | | +=v0640
+// b095 | | | | | +-+
+// | | | | | +=v0704
+// b046 | | | +-+
+// | | | | +=v0768
+// b096 | | | | +-+
+// | | | | | +=v0832
+// b069 | | | +-+
+// | | | +=v0055
+// b023 | | +-+
+// | | | | +=v0056
+// b070 | | | | +-+
+// | | | | | | +=v1280
+// b097 | | | | | +-+
+// | | | | | +=v1344
+// b047 | | | | +-+
+// | | | | | | +=v1408
+// b098 | | | | | | +-+
+// | | | | | | | +=v1472
+// b071 | | | | | +-+
+// | | | | | +=v0059
+// b032 | | | +-+
+// | | | | +=v0060
+// b072 | | | | +-+
+// | | | | | | +=v1536
+// b099 | | | | | +-+
+// | | | | | +=v1600
+// b048 | | | +-+
+// | | | +=v0024
+// b018 | +-+
+// | | +=v0025
+// b049 | | +-+
+// | | | | +=v1664
+// b100 | | | | +-+
+// | | | | | +=v1728
+// b073 | | | +-+
+// | | | +=v0320
+// b033 | | +-+
+// | | | | +=v0384
+// b074 | | | | +-+
+// | | | | | +=v0448
+// b050 | | | +-+
+// | | | | +=v0512
+// b101 | | | | +-+
+// | | | | | +=v0576
+// b075 | | | +-+
+// | | | +=v0053
+// b024 | +-+
+// | | +=v0054
+// b076 | | +-+
+// | | | | +=v0896
+// b102 | | | +-+
+// | | | +=v0960
+// b051 | | +-+
+// | | | | +=v1024
+// b103 | | | | +-+
+// | | | | | +=v1088
+// b077 | | | +-+
+// | | | | +=v1152
+// b104 | | | +-+
+// | | | +=v1216
+// b034 | +-+
+// | +=v0064
+// b010 +-+
+// | | +=v0013
+// b019 | | +-+
+// | | | | +=v0023
+// b052 | | | | +-+
+// | | | | | | +=v0050
+// b078 | | | | | +-+
+// | | | | | +=v0051
+// b035 | | | | +-+
+// | | | | | | +=v0044
+// b079 | | | | | | +-+
+// | | | | | | | +=v0045
+// b053 | | | | | +-+
+// | | | | | | +=v0046
+// b080 | | | | | +-+
+// | | | | | +=v0047
+// b025 | | | +-+
+// | | | | +=v0057
+// b081 | | | | +-+
+// | | | | | +=v0058
+// b054 | | | | +-+
+// | | | | | | +=v0061
+// b082 | | | | | +-+
+// | | | | | +=v0256
+// b036 | | | +-+
+// | | | +=v0016
+// b014 | +-+
+// | | +=v0017
+// b037 | | +-+
+// | | | | +=v0048
+// b083 | | | | +-+
+// | | | | | +=v0049
+// b055 | | | +-+
+// | | | | +=v0062
+// b084 | | | +-+
+// | | | +=v0063
+// b026 | | +-+
+// | | | | +=v0030
+// b085 | | | | +-+
+// | | | | | +=v0031
+// b056 | | | | +-+
+// | | | | | | +=v0032
+// b086 | | | | | +-+
+// | | | | | +=v0033
+// b038 | | | +-+
+// | | | | +=v0040
+// b087 | | | | +-+
+// | | | | | +=v0041
+// b057 | | | +-+
+// | | | +=v0022
+// b020 | +-+
+// | +=v0014
+// b008 +-+
+// | | +=v0010
+// b015 | | +-+
+// | | | +=v0011
+// b011 | +-+
+// | | +=v0015
+// b027 | | +-+
+// | | | | +=v0128
+// b088 | | | | +-+
+// | | | | | +=v0192
+// b058 | | | | +-+
+// | | | | | | +=v0026
+// b089 | | | | | +-+
+// | | | | | +=v0027
+// b039 | | | +-+
+// | | | | +=v0028
+// b090 | | | | +-+
+// | | | | | +=v0029
+// b059 | | | +-+
+// | | | +=v0019
+// b021 | | +-+
+// | | | | +=v0020
+// b060 | | | | +-+
+// | | | | | | +=v0034
+// b091 | | | | | +-+
+// | | | | | +=v0035
+// b040 | | | | +-+
+// | | | | | | +=v0036
+// b092 | | | | | | +-+
+// | | | | | | | +=v0037
+// b061 | | | | | +-+
+// | | | | | | +=v0038
+// b093 | | | | | +-+
+// | | | | | +=v0039
+// b028 | | | +-+
+// | | | | +=v0021
+// b062 | | | | +-+
+// | | | | | | +=v0042
+// b094 | | | | | +-+
+// | | | | | +=v0043
+// b041 | | | +-+
+// | | | +=v0000
+// b016 | +-+
+// | +=v0012
+// b006 +-+
+// | | +=v0009
+// b012 | | +-+
+// | | | +=v0008
+// b009 | +-+
+// | +=v0007
+// b004 +-+
+// | | +=v0006
+// b007 | +-+
+// | +=v0005
+// b002 +-+
+// | | +=v0001
+// b005 | +-+
+// | +=v0004
+// b001 +-+
+// | +=v0003
+// b003 +-+
+// +=v0002
var blackDecodeTable = [...][2]int16{
0: {0, 0},
1: {2, 3},
diff --git a/cmd/webp-manual-test/main.go b/cmd/webp-manual-test/main.go
index acb2815..824b944 100644
--- a/cmd/webp-manual-test/main.go
+++ b/cmd/webp-manual-test/main.go
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
-//
+
// This build tag means that "go install golang.org/x/image/..." doesn't
// install this manual test. Use "go run main.go" to explicitly run it.
diff --git a/draw/scale.go b/draw/scale.go
index 00121a1..ba1bdf3 100644
--- a/draw/scale.go
+++ b/draw/scale.go
@@ -46,8 +46,8 @@
//
// For example, if m is the matrix
//
-// m00 m01 m02
-// m10 m11 m12
+// m00 m01 m02
+// m10 m11 m12
//
// then the src-space point (sx, sy) maps to the dst-space point
// (m00*sx + m01*sy + m02, m10*sx + m11*sy + m12).
@@ -98,9 +98,9 @@
// have a 1:1 correspondence.
//
// Of the interpolators provided by this package:
-// - NearestNeighbor is fast but usually looks worst.
-// - CatmullRom is slow but usually looks best.
-// - ApproxBiLinear has reasonable speed and quality.
+// - NearestNeighbor is fast but usually looks worst.
+// - CatmullRom is slow but usually looks best.
+// - ApproxBiLinear has reasonable speed and quality.
//
// The time taken depends on the size of dr. For kernel interpolators, the
// speed also depends on the size of sr, and so are often slower than
diff --git a/example/font/main.go b/example/font/main.go
index 78fd112..aee01a4 100644
--- a/example/font/main.go
+++ b/example/font/main.go
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
-//
+
// This build tag means that "go install golang.org/x/image/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
// -tags=example" to install it.
diff --git a/font/gofont/gen.go b/font/gofont/gen.go
index c7cf2d8..bb867a4 100644
--- a/font/gofont/gen.go
+++ b/font/gofont/gen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
diff --git a/font/sfnt/gpos.go b/font/sfnt/gpos.go
index 5f4b765..e0e339c 100644
--- a/font/sfnt/gpos.go
+++ b/font/sfnt/gpos.go
@@ -14,7 +14,7 @@
hexFeatureKern = uint32(0x6b65726e) // kern
)
-//kernFunc returns the unscaled kerning value for kerning pair a+b.
+// kernFunc returns the unscaled kerning value for kerning pair a+b.
// Returns ErrNotFound if no kerning is specified for this pair.
type kernFunc func(a, b GlyphIndex) (int16, error)
diff --git a/font/sfnt/proprietary_test.go b/font/sfnt/proprietary_test.go
index 66f7d4b..15dde75 100644
--- a/font/sfnt/proprietary_test.go
+++ b/font/sfnt/proprietary_test.go
@@ -599,9 +599,9 @@
// proprietaryGlyphTestCases hold a sample of each font's glyph vectors. The
// numerical values can be verified by running the ttx tool, remembering that:
-// - for PostScript glyphs, ttx coordinates are relative.
-// - for TrueType glyphs, ttx coordinates are absolute, and consecutive
-// off-curve points implies an on-curve point at the midpoint.
+// - for PostScript glyphs, ttx coordinates are relative.
+// - for TrueType glyphs, ttx coordinates are absolute, and consecutive
+// off-curve points implies an on-curve point at the midpoint.
var proprietaryGlyphTestCases = map[string]map[rune][]Segment{
"adobe/SourceHanSansSC-Regular.otf": {
'!': {
diff --git a/tiff/lzw/reader.go b/tiff/lzw/reader.go
index 1930357..1ccf585 100644
--- a/tiff/lzw/reader.go
+++ b/tiff/lzw/reader.go
@@ -3,8 +3,8 @@
// license that can be found in the LICENSE file.
// Package lzw implements the Lempel-Ziv-Welch compressed data format,
-// described in T. A. Welch, ``A Technique for High-Performance Data
-// Compression'', Computer, 17(6) (June 1984), pp 8-19.
+// described in T. A. Welch, “A Technique for High-Performance Data
+// Compression”, Computer, 17(6) (June 1984), pp 8-19.
//
// In particular, it implements LZW as used by the TIFF file format, including
// an "off by one" algorithmic difference when compared to standard LZW.
diff --git a/vector/acc_test.go b/vector/acc_test.go
index 898bd8a..439c489 100644
--- a/vector/acc_test.go
+++ b/vector/acc_test.go
@@ -288,15 +288,19 @@
// "wrong". We're testing that we cope with them being different.
//
// On GOARCH=amd64, printing x and y gives:
-// 0.0142602495543672
-// 0.014260249212384224
+//
+// 0.0142602495543672
+// 0.014260249212384224
//
// On GOARCH=wasm, printing x and y gives:
-// 0.0142602495543672
-// 0.0142602495543672
+//
+// 0.0142602495543672
+// 0.0142602495543672
//
// The infinitely precise (mathematical) answer is:
-// 0.014260249554367201426024955436720142602495543672recurring...
+//
+// 0.014260249554367201426024955436720142602495543672recurring...
+//
// See https://play.golang.org/p/RxzKSdD_suE
//
// This test establishes a lower bound on approxEquals' tolerance constant.
diff --git a/vector/raster_fixed.go b/vector/raster_fixed.go
index 5b0fe7a..12330da 100644
--- a/vector/raster_fixed.go
+++ b/vector/raster_fixed.go
@@ -32,8 +32,11 @@
// The Rasterizer's bufU32 field, nominally of type []uint32 (since that slice
// is also used by other code), can be thought of as a []int2ϕ during the
// fixedLineTo method. Lines of code that are actually like:
+//
// buf[i] += uint32(etc) // buf has type []uint32.
+//
// can be thought of as
+//
// buf[i] += int2ϕ(etc) // buf has type []int2ϕ.
type int2ϕ int32
To view, visit change 399615. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ibb5f6484a6a544b7061abeff34c8c1f63a1e589d
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/399621
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: kokoro <noreply...@google.com>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
Auto-Submit: Russ Cox <r...@golang.org>
---
M tools/generate.go
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/tools/generate.go b/tools/generate.go
index 41535a9..d806abe 100644
--- a/tools/generate.go
+++ b/tools/generate.go
@@ -6,10 +6,12 @@
// the gopls's API and generate documentation from it.
//
// To update documentation based on the current package.json:
-// go run tools/generate.go
+//
+// go run tools/generate.go
//
// To update package.json and generate documentation.
-// go run tools/generate.go -gopls
+//
+// go run tools/generate.go -gopls
package main
import (
To view, visit change 399621. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ic04931a8c8a48d2ca5921a1cf7b3969efcb93cc3
Reviewed-on: https://go-review.googlesource.com/c/debug/+/399594
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
Auto-Submit: Russ Cox <r...@golang.org>
---
M dwtest/testdata/dwdumploc.go
M internal/core/core_test.go
M internal/gocore/dwarf.go
M internal/gocore/gocore_test.go
M internal/gocore/object.go
M internal/gocore/reverse.go
M internal/testenv/testenv.go
7 files changed, 46 insertions(+), 20 deletions(-)
diff --git a/dwtest/testdata/dwdumploc.go b/dwtest/testdata/dwdumploc.go
index 69ee702..60bca95 100644
--- a/dwtest/testdata/dwdumploc.go
+++ b/dwtest/testdata/dwdumploc.go
@@ -98,7 +98,6 @@
// elfOpener implements the opener interface for ELF
// (https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) binaries
-//
type elfOpener struct {
}
diff --git a/internal/core/core_test.go b/internal/core/core_test.go
index 1b5be13..654422e 100644
--- a/internal/core/core_test.go
+++ b/internal/core/core_test.go
@@ -14,10 +14,12 @@
// loadExample loads a simple core file which resulted from running the
// following program on linux/amd64 with go 1.9.0 (the earliest supported runtime):
-// package main
-// func main() {
-// _ = *(*int)(nil)
-// }
+//
+// package main
+//
+// func main() {
+// _ = *(*int)(nil)
+// }
func loadExample(t *testing.T, useExePath bool) *Process {
t.Helper()
var p *Process
diff --git a/internal/gocore/dwarf.go b/internal/gocore/dwarf.go
index c5cc173..0fc1d44 100644
--- a/internal/gocore/dwarf.go
+++ b/internal/gocore/dwarf.go
@@ -252,9 +252,10 @@
// gocoreName generates the name this package uses to refer to a dwarf type.
// This name differs from the dwarf name in that it stays closer to the Go name for the type.
// For instance (dwarf name -> gocoreName)
-// struct runtime.siginfo -> runtime.siginfo
-// *void -> unsafe.Pointer
-// struct struct { runtime.signalLock uint32; runtime.hz int32 } -> struct { signalLock uint32; hz int32 }
+//
+// struct runtime.siginfo -> runtime.siginfo
+// *void -> unsafe.Pointer
+// struct struct { runtime.signalLock uint32; runtime.hz int32 } -> struct { signalLock uint32; hz int32 }
func gocoreName(dt dwarf.Type) string {
switch x := dt.(type) {
case *dwarf.PtrType:
diff --git a/internal/gocore/gocore_test.go b/internal/gocore/gocore_test.go
index d233296..ece0b56 100644
--- a/internal/gocore/gocore_test.go
+++ b/internal/gocore/gocore_test.go
@@ -25,10 +25,12 @@
// loadTest loads a simple core file which resulted from running the
// following program on linux/amd64 with go 1.9.0 (the earliest supported runtime):
-// package main
-// func main() {
-// _ = *(*int)(nil)
-// }
+//
+// package main
+//
+// func main() {
+// _ = *(*int)(nil)
+// }
func loadExample(t *testing.T) *Process {
t.Helper()
if runtime.GOOS == "android" {
diff --git a/internal/gocore/object.go b/internal/gocore/object.go
index 15d1c38..88ea63c 100644
--- a/internal/gocore/object.go
+++ b/internal/gocore/object.go
@@ -247,9 +247,11 @@
// ForEachPtr calls fn for all heap pointers it finds in x.
// It calls fn with:
-// the offset of the pointer slot in x
-// the pointed-to object y
-// the offset in y where the pointer points.
+//
+// the offset of the pointer slot in x
+// the pointed-to object y
+// the offset in y where the pointer points.
+//
// If fn returns false, ForEachPtr returns immediately.
// For an edge from an object to its finalizer, the first argument
// passed to fn will be -1. (TODO: implement)
diff --git a/internal/gocore/reverse.go b/internal/gocore/reverse.go
index 40768a3..bc1e56a 100644
--- a/internal/gocore/reverse.go
+++ b/internal/gocore/reverse.go
@@ -80,9 +80,11 @@
// ForEachReversePtr calls fn for all pointers it finds pointing to y.
// It calls fn with:
-// the object or root which points to y (exactly one will be non-nil)
-// the offset i in that object or root where the pointer appears.
-// the offset j in y where the pointer points.
+//
+// the object or root which points to y (exactly one will be non-nil)
+// the offset i in that object or root where the pointer appears.
+// the offset j in y where the pointer points.
+//
// If fn returns false, ForEachReversePtr returns immediately.
func (p *Process) ForEachReversePtr(y Object, fn func(x Object, r *Root, i, j int64) bool) {
p.reverseEdges()
diff --git a/internal/testenv/testenv.go b/internal/testenv/testenv.go
index a48d7de..7ceff42 100644
--- a/internal/testenv/testenv.go
+++ b/internal/testenv/testenv.go
@@ -19,7 +19,7 @@
)
// HasGoBuild reports whether the current system can build programs
-// with ``go build'' and then run them with os.StartProcess or
+// with “go build” and then run them with os.StartProcess or
// exec.Command.
func HasGoBuild() bool {
if os.Getenv("GO_GCFLAGS") != "" {
@@ -36,7 +36,7 @@
return true
}
-// MustHaveGoBuild checks that the current system can build programs with ``go build''
+// MustHaveGoBuild checks that the current system can build programs with “go build”
// and then run them with os.StartProcess or exec.Command.
// If not, MustHaveGoBuild calls t.Skip with an explanation.
func MustHaveGoBuild(t testing.TB) {
To view, visit change 399594. To unsubscribe, or for help writing mail filters, visit settings.
all: gofmt
Gofmt to update doc comments to the new formatting.
(There are so many files in x/tools I am breaking up the
gofmt'ing into multiple CLs. This is the leftovers.)
For golang/go#51082.
Change-Id: Id9d440cde9de7093d2ffe06cbaa7098993823d6b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/399363
Run-TryBot: Russ Cox <r...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
gopls-CI: kokoro <noreply...@google.com>
TryBot-Result: Gopher Robot <go...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M container/intsets/sparse.go
M copyright/copyright.go
M go/ast/astutil/enclosing.go
M go/ast/astutil/enclosing_test.go
M go/ast/astutil/imports.go
M go/ast/astutil/rewrite.go
M go/ast/inspector/typeof.go
M go/buildutil/allpackages.go
M go/buildutil/fakecontext.go
M go/buildutil/overlay.go
M go/buildutil/tags.go
M go/buildutil/util.go
M go/cfg/builder.go
M go/cfg/cfg.go
M go/expect/expect.go
M go/gccgoexportdata/gccgoexportdata_test.go
M go/gcexportdata/gcexportdata.go
M go/gcexportdata/importer.go
M go/loader/doc.go
M go/loader/loader.go
M go/loader/util.go
M go/packages/doc.go
M go/packages/packages.go
M go/packages/packagestest/expect.go
M go/packages/packagestest/export.go
M go/packages/packagestest/gopath.go
M go/packages/packagestest/modules.go
M go/types/objectpath/objectpath.go
M go/types/typeutil/imports.go
M go/types/typeutil/map.go
M go/types/typeutil/methodsetcache.go
M go/types/typeutil/ui.go
M go/vcs/vcs.go
M godoc/analysis/analysis.go
M godoc/dirtrees.go
M godoc/format.go
M godoc/godoc.go
M godoc/index.go
M godoc/linkify.go
M godoc/meta.go
M godoc/server.go
M godoc/spot.go
M godoc/util/throttle.go
M godoc/vfs/namespace.go
M godoc/vfs/zipfs/zipfs.go
M imports/forward.go
M internal/apidiff/compatibility.go
M internal/event/export/ocagent/wire/metrics.go
M internal/fastwalk/fastwalk.go
M internal/imports/imports.go
M internal/memoize/memoize.go
M internal/stack/process.go
M internal/stack/stacktest/stacktest.go
M internal/testenv/testenv.go
M internal/typeparams/common.go
M internal/typeparams/example/findtypeparams/main.go
M internal/typeparams/normalize.go
M internal/typeparams/typeterm.go
M present/code.go
M present/doc.go
M refactor/eg/eg.go
M refactor/eg/match.go
M refactor/eg/rewrite.go
M refactor/rename/check.go
M refactor/rename/spec.go
M refactor/rename/util.go
M refactor/satisfy/find.go
M txtar/archive.go
68 files changed, 305 insertions(+), 342 deletions(-)
diff --git a/container/intsets/sparse.go b/container/intsets/sparse.go
index 2f1a0ea..c06aec8 100644
--- a/container/intsets/sparse.go
+++ b/container/intsets/sparse.go
@@ -10,7 +10,6 @@
// space-efficient than equivalent operations on sets based on the Go
// map type. The IsEmpty, Min, Max, Clear and TakeMin operations
// require constant time.
-//
package intsets // import "golang.org/x/tools/container/intsets"
// TODO(adonovan):
@@ -37,7 +36,6 @@
//
// Sparse sets must be copied using the Copy method, not by assigning
// a Sparse value.
-//
type Sparse struct {
// An uninitialized Sparse represents an empty set.
// An empty set may also be represented by
@@ -105,7 +103,6 @@
// is the Euclidean remainder.
//
// A block may only be empty transiently.
-//
type block struct {
offset int // offset mod bitsPerBlock == 0
bits [wordsPerBlock]word // contains at least one set bit
@@ -122,7 +119,6 @@
// insert sets the block b's ith bit and
// returns true if it was not already set.
-//
func (b *block) insert(i uint) bool {
w, mask := wordMask(i)
if b.bits[w]&mask == 0 {
@@ -135,7 +131,6 @@
// remove clears the block's ith bit and
// returns true if the bit was previously set.
// NB: may leave the block empty.
-//
func (b *block) remove(i uint) bool {
w, mask := wordMask(i)
if b.bits[w]&mask != 0 {
@@ -238,7 +233,6 @@
// offsetAndBitIndex returns the offset of the block that would
// contain x and the bit index of x within that block.
-//
func offsetAndBitIndex(x int) (int, uint) {
mod := x % bitsPerBlock
if mod < 0 {
@@ -438,9 +432,8 @@
//
// This method may be used for iteration over a worklist like so:
//
-// var x int
-// for worklist.TakeMin(&x) { use(x) }
-//
+// var x int
+// for worklist.TakeMin(&x) { use(x) }
func (s *Sparse) TakeMin(p *int) bool {
if s.IsEmpty() {
return false
@@ -466,7 +459,6 @@
// f must not mutate s. Consequently, forEach is not safe to expose
// to clients. In any case, using "range s.AppendTo()" allows more
// natural control flow with continue/break/return.
-//
func (s *Sparse) forEach(f func(int)) {
for b := s.first(); b != &none; b = s.next(b) {
b.forEach(f)
@@ -1021,11 +1013,11 @@
// preceded by a digit, appears if the sum is non-integral.
//
// Examples:
-// {}.BitString() = "0"
-// {4,5}.BitString() = "110000"
-// {-3}.BitString() = "0.001"
-// {-3,0,4,5}.BitString() = "110001.001"
//
+// {}.BitString() = "0"
+// {4,5}.BitString() = "110000"
+// {-3}.BitString() = "0.001"
+// {-3,0,4,5}.BitString() = "110001.001"
func (s *Sparse) BitString() string {
if s.IsEmpty() {
return "0"
@@ -1060,7 +1052,6 @@
// GoString returns a string showing the internal representation of
// the set s.
-//
func (s *Sparse) GoString() string {
var buf bytes.Buffer
for b := s.first(); b != &none; b = s.next(b) {
diff --git a/copyright/copyright.go b/copyright/copyright.go
index 4a04d13..eb56ef2 100644
--- a/copyright/copyright.go
+++ b/copyright/copyright.go
@@ -96,6 +96,7 @@
// Copied from golang.org/x/tools/internal/lsp/source/util.go.
// Matches cgo generated comment as well as the proposed standard:
+//
// https://golang.org/s/generatedcode
var generatedRx = regexp.MustCompile(`// .*DO NOT EDIT\.?`)
diff --git a/go/ast/astutil/enclosing.go b/go/ast/astutil/enclosing.go
index a5c6d6d..1d8c401 100644
--- a/go/ast/astutil/enclosing.go
+++ b/go/ast/astutil/enclosing.go
@@ -22,9 +22,9 @@
// additional whitespace abutting a node to be enclosed by it.
// In this example:
//
-// z := x + y // add them
-// <-A->
-// <----B----->
+// z := x + y // add them
+// <-A->
+// <----B----->
//
// the ast.BinaryExpr(+) node is considered to enclose interval B
// even though its [Pos()..End()) is actually only interval A.
@@ -43,10 +43,10 @@
// interior whitespace of path[0].
// In this example:
//
-// z := x + y // add them
-// <--C--> <---E-->
-// ^
-// D
+// z := x + y // add them
+// <--C--> <---E-->
+// ^
+// D
//
// intervals C, D and E are inexact. C is contained by the
// z-assignment statement, because it spans three of its children (:=,
@@ -59,7 +59,6 @@
// Requires FileSet; see loader.tokenFileContainsPos.
//
// Postcondition: path is never nil; it always contains at least 'root'.
-//
func PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) {
// fmt.Printf("EnclosingInterval %d %d\n", start, end) // debugging
@@ -162,7 +161,6 @@
// tokenNode is a dummy implementation of ast.Node for a single token.
// They are used transiently by PathEnclosingInterval but never escape
// this package.
-//
type tokenNode struct {
pos token.Pos
end token.Pos
@@ -183,7 +181,6 @@
// childrenOf returns the direct non-nil children of ast.Node n.
// It may include fake ast.Node implementations for bare tokens.
// it is not safe to call (e.g.) ast.Walk on such nodes.
-//
func childrenOf(n ast.Node) []ast.Node {
var children []ast.Node
@@ -488,7 +485,6 @@
// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident,
// StarExpr) we could be much more specific given the path to the AST
// root. Perhaps we should do that.
-//
func NodeDescription(n ast.Node) string {
switch n := n.(type) {
case *ast.ArrayType:
diff --git a/go/ast/astutil/enclosing_test.go b/go/ast/astutil/enclosing_test.go
index 5e86ff9..de96d44 100644
--- a/go/ast/astutil/enclosing_test.go
+++ b/go/ast/astutil/enclosing_test.go
@@ -40,7 +40,6 @@
// findInterval parses input and returns the [start, end) positions of
// the first occurrence of substr in input. f==nil indicates failure;
// an error has already been reported in that case.
-//
func findInterval(t *testing.T, fset *token.FileSet, input, substr string) (f *ast.File, start, end token.Pos) {
f, err := parser.ParseFile(fset, "<input>", input, 0)
if err != nil {
diff --git a/go/ast/astutil/imports.go b/go/ast/astutil/imports.go
index f7413ce..18d1adb 100644
--- a/go/ast/astutil/imports.go
+++ b/go/ast/astutil/imports.go
@@ -22,8 +22,11 @@
// If name is not empty, it is used to rename the import.
//
// For example, calling
+//
// AddNamedImport(fset, f, "pathpkg", "path")
+//
// adds
+//
// import pathpkg "path"
func AddNamedImport(fset *token.FileSet, f *ast.File, name, path string) (added bool) {
if imports(f, name, path) {
diff --git a/go/ast/astutil/rewrite.go b/go/ast/astutil/rewrite.go
index 6d9ca23..729e9c8 100644
--- a/go/ast/astutil/rewrite.go
+++ b/go/ast/astutil/rewrite.go
@@ -41,7 +41,6 @@
// Children are traversed in the order in which they appear in the
// respective node's struct definition. A package's files are
// traversed in the filenames' alphabetical order.
-//
func Apply(root ast.Node, pre, post ApplyFunc) (result ast.Node) {
parent := &struct{ ast.Node }{root}
defer func() {
@@ -65,8 +64,8 @@
// c.Parent(), and f is the field identifier with name c.Name(),
// the following invariants hold:
//
-// p.f == c.Node() if c.Index() < 0
-// p.f[c.Index()] == c.Node() if c.Index() >= 0
+// p.f == c.Node() if c.Index() < 0
+// p.f[c.Index()] == c.Node() if c.Index() >= 0
//
// The methods Replace, Delete, InsertBefore, and InsertAfter
// can be used to change the AST without disrupting Apply.
diff --git a/go/ast/inspector/typeof.go b/go/ast/inspector/typeof.go
index 11f4fc3..11ab2bc 100644
--- a/go/ast/inspector/typeof.go
+++ b/go/ast/inspector/typeof.go
@@ -77,12 +77,14 @@
// typeOf returns a distinct single-bit value that represents the type of n.
//
// Various implementations were benchmarked with BenchmarkNewInspector:
-// GOGC=off
-// - type switch 4.9-5.5ms 2.1ms
-// - binary search over a sorted list of types 5.5-5.9ms 2.5ms
-// - linear scan, frequency-ordered list 5.9-6.1ms 2.7ms
-// - linear scan, unordered list 6.4ms 2.7ms
-// - hash table 6.5ms 3.1ms
+//
+// GOGC=off
+// - type switch 4.9-5.5ms 2.1ms
+// - binary search over a sorted list of types 5.5-5.9ms 2.5ms
+// - linear scan, frequency-ordered list 5.9-6.1ms 2.7ms
+// - linear scan, unordered list 6.4ms 2.7ms
+// - hash table 6.5ms 3.1ms
+//
// A perfect hash seemed like overkill.
//
// The compiler's switch statement is the clear winner
@@ -90,7 +92,6 @@
// with constant conditions and good branch prediction.
// (Sadly it is the most verbose in source code.)
// Binary search suffered from poor branch prediction.
-//
func typeOf(n ast.Node) uint64 {
// Fast path: nearly half of all nodes are identifiers.
if _, ok := n.(*ast.Ident); ok {
diff --git a/go/buildutil/allpackages.go b/go/buildutil/allpackages.go
index c0cb03e..dfb8cd6 100644
--- a/go/buildutil/allpackages.go
+++ b/go/buildutil/allpackages.go
@@ -28,7 +28,6 @@
//
// All I/O is done via the build.Context file system interface,
// which must be concurrency-safe.
-//
func AllPackages(ctxt *build.Context) []string {
var list []string
ForEachPackage(ctxt, func(pkg string, _ error) {
@@ -48,7 +47,6 @@
//
// All I/O is done via the build.Context file system interface,
// which must be concurrency-safe.
-//
func ForEachPackage(ctxt *build.Context, found func(importPath string, err error)) {
ch := make(chan item)
@@ -127,19 +125,18 @@
// ExpandPatterns returns the set of packages matched by patterns,
// which may have the following forms:
//
-// golang.org/x/tools/cmd/guru # a single package
-// golang.org/x/tools/... # all packages beneath dir
-// ... # the entire workspace.
+// golang.org/x/tools/cmd/guru # a single package
+// golang.org/x/tools/... # all packages beneath dir
+// ... # the entire workspace.
//
// Order is significant: a pattern preceded by '-' removes matching
// packages from the set. For example, these patterns match all encoding
// packages except encoding/xml:
//
-// encoding/... -encoding/xml
+// encoding/... -encoding/xml
//
// A trailing slash in a pattern is ignored. (Path components of Go
// package names are separated by slash, not the platform's path separator.)
-//
func ExpandPatterns(ctxt *build.Context, patterns []string) map[string]bool {
// TODO(adonovan): support other features of 'go list':
// - "std"/"cmd"/"all" meta-packages
diff --git a/go/buildutil/fakecontext.go b/go/buildutil/fakecontext.go
index 5fc672f..15025f6 100644
--- a/go/buildutil/fakecontext.go
+++ b/go/buildutil/fakecontext.go
@@ -30,7 +30,6 @@
// /go/src/ including, for instance, "math" and "math/big".
// ReadDir("/go/src/math/big") would return all the files in the
// "math/big" package.
-//
func FakeContext(pkgs map[string]map[string]string) *build.Context {
clean := func(filename string) string {
f := path.Clean(filepath.ToSlash(filename))
diff --git a/go/buildutil/overlay.go b/go/buildutil/overlay.go
index 8e23908..bdbfd93 100644
--- a/go/buildutil/overlay.go
+++ b/go/buildutil/overlay.go
@@ -60,8 +60,7 @@
// ParseOverlayArchive parses an archive containing Go files and their
// contents. The result is intended to be used with OverlayContext.
//
-//
-// Archive format
+// # Archive format
//
// The archive consists of a series of files. Each file consists of a
// name, a decimal file size and the file contents, separated by
diff --git a/go/buildutil/tags.go b/go/buildutil/tags.go
index 6da0ce4..7cf523b 100644
--- a/go/buildutil/tags.go
+++ b/go/buildutil/tags.go
@@ -20,7 +20,8 @@
// See $GOROOT/src/cmd/go/doc.go for description of 'go build -tags' flag.
//
// Example:
-// flag.Var((*buildutil.TagsFlag)(&build.Default.BuildTags), "tags", buildutil.TagsFlagDoc)
+//
+// flag.Var((*buildutil.TagsFlag)(&build.Default.BuildTags), "tags", buildutil.TagsFlagDoc)
type TagsFlag []string
func (v *TagsFlag) Set(s string) error {
diff --git a/go/buildutil/util.go b/go/buildutil/util.go
index fc923d7..d771b18 100644
--- a/go/buildutil/util.go
+++ b/go/buildutil/util.go
@@ -28,7 +28,6 @@
// filename that will be attached to the ASTs.
//
// TODO(adonovan): call this from go/loader.parseFiles when the tree thaws.
-//
func ParseFile(fset *token.FileSet, ctxt *build.Context, displayPath func(string) string, dir string, file string, mode parser.Mode) (*ast.File, error) {
if !IsAbsPath(ctxt, file) {
file = JoinPath(ctxt, dir, file)
@@ -51,7 +50,6 @@
//
// The '...Files []string' fields of the resulting build.Package are not
// populated (build.FindOnly mode).
-//
func ContainingPackage(ctxt *build.Context, dir, filename string) (*build.Package, error) {
if !IsAbsPath(ctxt, filename) {
filename = JoinPath(ctxt, dir, filename)
@@ -196,7 +194,6 @@
// sameFile returns true if x and y have the same basename and denote
// the same file.
-//
func sameFile(x, y string) bool {
if path.Clean(x) == path.Clean(y) {
return true
diff --git a/go/cfg/builder.go b/go/cfg/builder.go
index 7f95a29..dad6a44 100644
--- a/go/cfg/builder.go
+++ b/go/cfg/builder.go
@@ -443,7 +443,6 @@
// Destinations associated with unlabeled for/switch/select stmts.
// We push/pop one of these as we enter/leave each construct and for
// each BranchStmt we scan for the innermost target of the right type.
-//
type targets struct {
tail *targets // rest of stack
_break *Block
@@ -454,7 +453,6 @@
// Destinations associated with a labeled block.
// We populate these as labels are encountered in forward gotos or
// labeled statements.
-//
type lblock struct {
_goto *Block
_break *Block
@@ -463,7 +461,6 @@
// labeledBlock returns the branch target associated with the
// specified label, creating it if needed.
-//
func (b *builder) labeledBlock(label *ast.Ident) *lblock {
lb := b.lblocks[label.Obj]
if lb == nil {
diff --git a/go/cfg/cfg.go b/go/cfg/cfg.go
index 3ebc65f..37d799f 100644
--- a/go/cfg/cfg.go
+++ b/go/cfg/cfg.go
@@ -20,14 +20,14 @@
//
// produces this CFG:
//
-// 1: x := f()
-// x != nil
-// succs: 2, 3
-// 2: T()
-// succs: 4
-// 3: F()
-// succs: 4
-// 4:
+// 1: x := f()
+// x != nil
+// succs: 2, 3
+// 2: T()
+// succs: 4
+// 3: F()
+// succs: 4
+// 4:
//
// The CFG does contain Return statements; even implicit returns are
// materialized (at the position of the function's closing brace).
@@ -36,7 +36,6 @@
// edges, nor the short-circuit semantics of the && and || operators,
// nor abnormal control flow caused by panic. If you need this
// information, use golang.org/x/tools/go/ssa instead.
-//
package cfg
import (
diff --git a/go/expect/expect.go b/go/expect/expect.go
index bb203f5..f5172ce 100644
--- a/go/expect/expect.go
+++ b/go/expect/expect.go
@@ -16,20 +16,19 @@
For example, the test suite for a static checking tool might
use a @diag note to indicate an expected diagnostic:
- fmt.Printf("%s", 1) //@ diag("%s wants a string, got int")
+ fmt.Printf("%s", 1) //@ diag("%s wants a string, got int")
By contrast, the test suite for a source code navigation tool
might use notes to indicate the positions of features of
interest, the actions to be performed by the test,
and their expected outcomes:
- var x = 1 //@ x_decl
- ...
- print(x) //@ definition("x", x_decl)
- print(x) //@ typeof("x", "int")
+ var x = 1 //@ x_decl
+ ...
+ print(x) //@ definition("x", x_decl)
+ print(x) //@ typeof("x", "int")
-
-Note comment syntax
+# Note comment syntax
Note comments always start with the special marker @, which must be the
very first character after the comment opening pair, so //@ or /*@ with no
diff --git a/go/gccgoexportdata/gccgoexportdata_test.go b/go/gccgoexportdata/gccgoexportdata_test.go
index 0d04102..39f0981 100644
--- a/go/gccgoexportdata/gccgoexportdata_test.go
+++ b/go/gccgoexportdata/gccgoexportdata_test.go
@@ -18,12 +18,12 @@
//
// The testdata/{short,long}.a ELF archive files were produced by:
//
-// $ echo 'package foo; func F()' > foo.go
-// $ gccgo -c -fgo-pkgpath blah foo.go
-// $ objcopy -j .go_export foo.o foo.gox
-// $ ar q short.a foo.gox
-// $ objcopy -j .go_export foo.o name-longer-than-16-bytes.gox
-// $ ar q long.a name-longer-than-16-bytes.gox
+// $ echo 'package foo; func F()' > foo.go
+// $ gccgo -c -fgo-pkgpath blah foo.go
+// $ objcopy -j .go_export foo.o foo.gox
+// $ ar q short.a foo.gox
+// $ objcopy -j .go_export foo.o name-longer-than-16-bytes.gox
+// $ ar q long.a name-longer-than-16-bytes.gox
//
// The file long.a contains an archive string table.
//
diff --git a/go/gcexportdata/gcexportdata.go b/go/gcexportdata/gcexportdata.go
index cec819d6..d50826d 100644
--- a/go/gcexportdata/gcexportdata.go
+++ b/go/gcexportdata/gcexportdata.go
@@ -17,7 +17,6 @@
// developer tools, which will then be able to consume both Go 1.7 and
// Go 1.8 export data files, so they will work before and after the
// Go update. (See discussion at https://golang.org/issue/15651.)
-//
package gcexportdata // import "golang.org/x/tools/go/gcexportdata"
import (
diff --git a/go/gcexportdata/importer.go b/go/gcexportdata/importer.go
index efe221e..fe6ed93 100644
--- a/go/gcexportdata/importer.go
+++ b/go/gcexportdata/importer.go
@@ -22,7 +22,6 @@
// version-skew problems described in the documentation of this package,
// or to control the FileSet or access the imports map populated during
// package loading.
-//
func NewImporter(fset *token.FileSet, imports map[string]*types.Package) types.ImporterFrom {
return importer{fset, imports}
}
diff --git a/go/loader/doc.go b/go/loader/doc.go
index c5aa31c..e35b1fd 100644
--- a/go/loader/doc.go
+++ b/go/loader/doc.go
@@ -20,36 +20,35 @@
// be called any number of times. Finally, these are followed by a
// call to Load() to actually load and type-check the program.
//
-// var conf loader.Config
+// var conf loader.Config
//
-// // Use the command-line arguments to specify
-// // a set of initial packages to load from source.
-// // See FromArgsUsage for help.
-// rest, err := conf.FromArgs(os.Args[1:], wantTests)
+// // Use the command-line arguments to specify
+// // a set of initial packages to load from source.
+// // See FromArgsUsage for help.
+// rest, err := conf.FromArgs(os.Args[1:], wantTests)
//
-// // Parse the specified files and create an ad hoc package with path "foo".
-// // All files must have the same 'package' declaration.
-// conf.CreateFromFilenames("foo", "foo.go", "bar.go")
+// // Parse the specified files and create an ad hoc package with path "foo".
+// // All files must have the same 'package' declaration.
+// conf.CreateFromFilenames("foo", "foo.go", "bar.go")
//
-// // Create an ad hoc package with path "foo" from
-// // the specified already-parsed files.
-// // All ASTs must have the same 'package' declaration.
-// conf.CreateFromFiles("foo", parsedFiles)
+// // Create an ad hoc package with path "foo" from
+// // the specified already-parsed files.
+// // All ASTs must have the same 'package' declaration.
+// conf.CreateFromFiles("foo", parsedFiles)
//
-// // Add "runtime" to the set of packages to be loaded.
-// conf.Import("runtime")
+// // Add "runtime" to the set of packages to be loaded.
+// conf.Import("runtime")
//
-// // Adds "fmt" and "fmt_test" to the set of packages
-// // to be loaded. "fmt" will include *_test.go files.
-// conf.ImportWithTests("fmt")
+// // Adds "fmt" and "fmt_test" to the set of packages
+// // to be loaded. "fmt" will include *_test.go files.
+// conf.ImportWithTests("fmt")
//
-// // Finally, load all the packages specified by the configuration.
-// prog, err := conf.Load()
+// // Finally, load all the packages specified by the configuration.
+// prog, err := conf.Load()
//
// See examples_test.go for examples of API usage.
//
-//
-// CONCEPTS AND TERMINOLOGY
+// # CONCEPTS AND TERMINOLOGY
//
// The WORKSPACE is the set of packages accessible to the loader. The
// workspace is defined by Config.Build, a *build.Context. The
@@ -92,7 +91,6 @@
// The INITIAL packages are those specified in the configuration. A
// DEPENDENCY is a package loaded to satisfy an import in an initial
// package or another dependency.
-//
package loader
// IMPLEMENTATION NOTES
diff --git a/go/loader/loader.go b/go/loader/loader.go
index 3ba91f7..edf62c2 100644
--- a/go/loader/loader.go
+++ b/go/loader/loader.go
@@ -179,7 +179,6 @@
// for a single package.
//
// Not mutated once exposed via the API.
-//
type PackageInfo struct {
Pkg *types.Package
Importable bool // true if 'import "Pkg.Path()"' would resolve to this
@@ -217,7 +216,6 @@
// src specifies the parser input as a string, []byte, or io.Reader, and
// filename is its apparent name. If src is nil, the contents of
// filename are read from the file system.
-//
func (conf *Config) ParseFile(filename string, src interface{}) (*ast.File, error) {
// TODO(adonovan): use conf.build() etc like parseFiles does.
return parser.ParseFile(conf.fset(), filename, src, conf.ParserMode)
@@ -262,7 +260,6 @@
//
// Only superficial errors are reported at this stage; errors dependent
// on I/O are detected during Load.
-//
func (conf *Config) FromArgs(args []string, xtest bool) ([]string, error) {
var rest []string
for i, arg := range args {
@@ -300,14 +297,12 @@
// CreateFromFilenames is a convenience function that adds
// a conf.CreatePkgs entry to create a package of the specified *.go
// files.
-//
func (conf *Config) CreateFromFilenames(path string, filenames ...string) {
conf.CreatePkgs = append(conf.CreatePkgs, PkgSpec{Path: path, Filenames: filenames})
}
// CreateFromFiles is a convenience function that adds a conf.CreatePkgs
// entry to create package of the specified path and parsed files.
-//
func (conf *Config) CreateFromFiles(path string, files ...*ast.File) {
conf.CreatePkgs = append(conf.CreatePkgs, PkgSpec{Path: path, Files: files})
}
@@ -321,12 +316,10 @@
// In addition, if any *_test.go files contain a "package x_test"
// declaration, an additional package comprising just those files will
// be added to CreatePkgs.
-//
func (conf *Config) ImportWithTests(path string) { conf.addImport(path, true) }
// Import is a convenience function that adds path to ImportPkgs, the
// set of initial packages that will be imported from source.
-//
func (conf *Config) Import(path string) { conf.addImport(path, false) }
func (conf *Config) addImport(path string, tests bool) {
@@ -345,7 +338,6 @@
// exact is defined as for astutil.PathEnclosingInterval.
//
// The zero value is returned if not found.
-//
func (prog *Program) PathEnclosingInterval(start, end token.Pos) (pkg *PackageInfo, path []ast.Node, exact bool) {
for _, info := range prog.AllPackages {
for _, f := range info.Files {
@@ -368,7 +360,6 @@
// InitialPackages returns a new slice containing the set of initial
// packages (Created + Imported) in unspecified order.
-//
func (prog *Program) InitialPackages() []*PackageInfo {
infos := make([]*PackageInfo, 0, len(prog.Created)+len(prog.Imported))
infos = append(infos, prog.Created...)
@@ -435,7 +426,6 @@
// Upon completion, exactly one of info and err is non-nil:
// info on successful creation of a package, err otherwise.
// A successful package may still contain type errors.
-//
type importInfo struct {
path string // import path
info *PackageInfo // results of typechecking (including errors)
@@ -475,7 +465,6 @@
// false, Load will fail if any package had an error.
//
// It is an error if no packages were loaded.
-//
func (conf *Config) Load() (*Program, error) {
// Create a simple default error handler for parse/type errors.
if conf.TypeChecker.Error == nil {
@@ -732,10 +721,10 @@
// errors that were encountered.
//
// 'which' indicates which files to include:
-// 'g': include non-test *.go source files (GoFiles + processed CgoFiles)
-// 't': include in-package *_test.go source files (TestGoFiles)
-// 'x': include external *_test.go source files. (XTestGoFiles)
//
+// 'g': include non-test *.go source files (GoFiles + processed CgoFiles)
+// 't': include in-package *_test.go source files (TestGoFiles)
+// 'x': include external *_test.go source files. (XTestGoFiles)
func (conf *Config) parsePackageFiles(bp *build.Package, which rune) ([]*ast.File, []error) {
if bp.ImportPath == "unsafe" {
return nil, nil
@@ -776,7 +765,6 @@
// in the package's PackageInfo).
//
// Idempotent.
-//
func (imp *importer) doImport(from *PackageInfo, to string) (*types.Package, error) {
if to == "C" {
// This should be unreachable, but ad hoc packages are
@@ -868,7 +856,6 @@
//
// fromDir is the directory containing the import declaration that
// caused these imports.
-//
func (imp *importer) importAll(fromPath, fromDir string, imports map[string]bool, mode build.ImportMode) (infos []*PackageInfo, errors []importError) {
if fromPath != "" {
// We're loading a set of imports.
@@ -951,7 +938,6 @@
// caller must call awaitCompletion() before accessing its info field.
//
// startLoad is concurrency-safe and idempotent.
-//
func (imp *importer) startLoad(bp *build.Package) *importInfo {
path := bp.ImportPath
imp.importedMu.Lock()
@@ -995,7 +981,6 @@
//
// cycleCheck determines whether the imports within files create
// dependency edges that should be checked for potential cycles.
-//
func (imp *importer) addFiles(info *PackageInfo, files []*ast.File, cycleCheck bool) {
// Ensure the dependencies are loaded, in parallel.
var fromPath string
diff --git a/go/loader/util.go b/go/loader/util.go
index 7f38dd7..3a80aca 100644
--- a/go/loader/util.go
+++ b/go/loader/util.go
@@ -27,7 +27,6 @@
//
// I/O is done via ctxt, which may specify a virtual file system.
// displayPath is used to transform the filenames attached to the ASTs.
-//
func parseFiles(fset *token.FileSet, ctxt *build.Context, displayPath func(string) string, dir string, files []string, mode parser.Mode) ([]*ast.File, []error) {
if displayPath == nil {
displayPath = func(path string) string { return path }
diff --git a/go/packages/doc.go b/go/packages/doc.go
index 4bfe28a..da4ab89 100644
--- a/go/packages/doc.go
+++ b/go/packages/doc.go
@@ -67,7 +67,6 @@
uninterpreted to the loader, so that the loader can interpret them
according to the conventions of the underlying build system.
See the Example function for typical usage.
-
*/
package packages // import "golang.org/x/tools/go/packages"
diff --git a/go/packages/packages.go b/go/packages/packages.go
index 2442845..f9bc35d 100644
--- a/go/packages/packages.go
+++ b/go/packages/packages.go
@@ -1079,7 +1079,6 @@
//
// Because files are scanned in parallel, the token.Pos
// positions of the resulting ast.Files are not ordered.
-//
func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) {
var wg sync.WaitGroup
n := len(filenames)
@@ -1123,7 +1122,6 @@
// sameFile returns true if x and y have the same basename and denote
// the same file.
-//
func sameFile(x, y string) bool {
if x == y {
// It could be the case that y doesn't exist.
diff --git a/go/packages/packagestest/expect.go b/go/packages/packagestest/expect.go
index c1781e7..3088d43 100644
--- a/go/packages/packagestest/expect.go
+++ b/go/packages/packagestest/expect.go
@@ -41,24 +41,27 @@
// call the Mark method to add the marker to the global set.
// You can register the "mark" method to override these in your own call to
// Expect. The bound Mark function is usable directly in your method map, so
-// exported.Expect(map[string]interface{}{"mark": exported.Mark})
+//
+// exported.Expect(map[string]interface{}{"mark": exported.Mark})
+//
// replicates the built in behavior.
//
-// Method invocation
+// # Method invocation
//
// When invoking a method the expressions in the parameter list need to be
// converted to values to be passed to the method.
// There are a very limited set of types the arguments are allowed to be.
-// expect.Note : passed the Note instance being evaluated.
-// string : can be supplied either a string literal or an identifier.
-// int : can only be supplied an integer literal.
-// *regexp.Regexp : can only be supplied a regular expression literal
-// token.Pos : has a file position calculated as described below.
-// token.Position : has a file position calculated as described below.
-// expect.Range: has a start and end position as described below.
-// interface{} : will be passed any value
//
-// Position calculation
+// expect.Note : passed the Note instance being evaluated.
+// string : can be supplied either a string literal or an identifier.
+// int : can only be supplied an integer literal.
+// *regexp.Regexp : can only be supplied a regular expression literal
+// token.Pos : has a file position calculated as described below.
+// token.Position : has a file position calculated as described below.
+// expect.Range: has a start and end position as described below.
+// interface{} : will be passed any value
+//
+// # Position calculation
//
// There is some extra handling when a parameter is being coerced into a
// token.Pos, token.Position or Range type argument.
diff --git a/go/packages/packagestest/export.go b/go/packages/packagestest/export.go
index d792c3c..996be03 100644
--- a/go/packages/packagestest/export.go
+++ b/go/packages/packagestest/export.go
@@ -9,7 +9,7 @@
systems from the same description, and run the same tests on them in many
cases.
-Example
+# Example
As an example of packagestest use, consider the following test that runs
the 'go list' command on the specified modules:
@@ -60,7 +60,6 @@
main_test.go:36: 'go list gopher.example/...' with Modules mode layout:
gopher.example/repoa/a
gopher.example/repob/b
-
*/
package packagestest
@@ -452,17 +451,19 @@
// GroupFilesByModules attempts to map directories to the modules within each directory.
// This function assumes that the folder is structured in the following way:
-// - dir
-// - primarymod
-// - .go files
-// - packages
-// - go.mod (optional)
-// - modules
-// - repoa
-// - mod1
-// - .go files
-// - packages
-// - go.mod (optional)
+//
+// dir/
+// primarymod/
+// *.go files
+// packages
+// go.mod (optional)
+// modules/
+// repoa/
+// mod1/
+// *.go files
+// packages
+// go.mod (optional)
+//
// It scans the directory tree anchored at root and adds a Copy writer to the
// map for every file found.
// This is to enable the common case in tests where you have a full copy of the
diff --git a/go/packages/packagestest/gopath.go b/go/packages/packagestest/gopath.go
index 5401685..d56f523 100644
--- a/go/packages/packagestest/gopath.go
+++ b/go/packages/packagestest/gopath.go
@@ -12,26 +12,33 @@
// GOPATH is the exporter that produces GOPATH layouts.
// Each "module" is put in it's own GOPATH entry to help test complex cases.
// Given the two files
-// golang.org/repoa#a/a.go
-// golang.org/repob#b/b.go
+//
+// golang.org/repoa#a/a.go
+// golang.org/repob#b/b.go
+//
// You would get the directory layout
-// /sometemporarydirectory
-// ├── repoa
-// │ └── src
-// │ └── golang.org
-// │ └── repoa
-// │ └── a
-// │ └── a.go
-// └── repob
-// └── src
-// └── golang.org
-// └── repob
-// └── b
-// └── b.go
+//
+// /sometemporarydirectory
+// ├── repoa
+// │ └── src
+// │ └── golang.org
+// │ └── repoa
+// │ └── a
+// │ └── a.go
+// └── repob
+// └── src
+// └── golang.org
+// └── repob
+// └── b
+// └── b.go
+//
// GOPATH would be set to
-// /sometemporarydirectory/repoa;/sometemporarydirectory/repob
+//
+// /sometemporarydirectory/repoa;/sometemporarydirectory/repob
+//
// and the working directory would be
-// /sometemporarydirectory/repoa/src
+//
+// /sometemporarydirectory/repoa/src
var GOPATH = gopath{}
func init() {
diff --git a/go/packages/packagestest/modules.go b/go/packages/packagestest/modules.go
index 2c43567..69a6c93 100644
--- a/go/packages/packagestest/modules.go
+++ b/go/packages/packagestest/modules.go
@@ -23,20 +23,25 @@
// Each "repository" is put in it's own module, and the module file generated
// will have replace directives for all other modules.
// Given the two files
-// golang.org/repoa#a/a.go
-// golang.org/repob#b/b.go
+//
+// golang.org/repoa#a/a.go
+// golang.org/repob#b/b.go
+//
// You would get the directory layout
-// /sometemporarydirectory
-// ├── repoa
-// │ ├── a
-// │ │ └── a.go
-// │ └── go.mod
-// └── repob
-// ├── b
-// │ └── b.go
-// └── go.mod
+//
+// /sometemporarydirectory
+// ├── repoa
+// │ ├── a
+// │ │ └── a.go
+// │ └── go.mod
+// └── repob
+// ├── b
+// │ └── b.go
+// └── go.mod
+//
// and the working directory would be
-// /sometemporarydirectory/repoa
+//
+// /sometemporarydirectory/repoa
var Modules = modules{}
type modules struct{}
diff --git a/go/types/objectpath/objectpath.go b/go/types/objectpath/objectpath.go
index 557202b..f27d871 100644
--- a/go/types/objectpath/objectpath.go
+++ b/go/types/objectpath/objectpath.go
@@ -14,8 +14,10 @@
// distinct but logically equivalent.
//
// A single object may have multiple paths. In this example,
-// type A struct{ X int }
-// type B A
+//
+// type A struct{ X int }
+// type B A
+//
// the field X has two paths due to its membership of both A and B.
// The For(obj) function always returns one of these paths, arbitrarily
// but consistently.
@@ -45,30 +47,30 @@
// The sequences represent a path through the package/object/type graph.
// We classify these operators by their type:
//
-// PO package->object Package.Scope.Lookup
-// OT object->type Object.Type
-// TT type->type Type.{Elem,Key,Params,Results,Underlying} [EKPRU]
-// TO type->object Type.{At,Field,Method,Obj} [AFMO]
+// PO package->object Package.Scope.Lookup
+// OT object->type Object.Type
+// TT type->type Type.{Elem,Key,Params,Results,Underlying} [EKPRU]
+// TO type->object Type.{At,Field,Method,Obj} [AFMO]
//
// All valid paths start with a package and end at an object
// and thus may be defined by the regular language:
//
-// objectpath = PO (OT TT* TO)*
+// objectpath = PO (OT TT* TO)*
//
// The concrete encoding follows directly:
-// - The only PO operator is Package.Scope.Lookup, which requires an identifier.
-// - The only OT operator is Object.Type,
-// which we encode as '.' because dot cannot appear in an identifier.
-// - The TT operators are encoded as [EKPRUTC];
-// one of these (TypeParam) requires an integer operand,
-// which is encoded as a string of decimal digits.
-// - The TO operators are encoded as [AFMO];
-// three of these (At,Field,Method) require an integer operand,
-// which is encoded as a string of decimal digits.
-// These indices are stable across different representations
-// of the same package, even source and export data.
-// The indices used are implementation specific and may not correspond to
-// the argument to the go/types function.
+// - The only PO operator is Package.Scope.Lookup, which requires an identifier.
+// - The only OT operator is Object.Type,
+// which we encode as '.' because dot cannot appear in an identifier.
+// - The TT operators are encoded as [EKPRUTC];
+// one of these (TypeParam) requires an integer operand,
+// which is encoded as a string of decimal digits.
+// - The TO operators are encoded as [AFMO];
+// three of these (At,Field,Method) require an integer operand,
+// which is encoded as a string of decimal digits.
+// These indices are stable across different representations
+// of the same package, even source and export data.
+// The indices used are implementation specific and may not correspond to
+// the argument to the go/types function.
//
// In the example below,
//
@@ -81,15 +83,14 @@
// field X has the path "T.UM0.RA1.F0",
// representing the following sequence of operations:
//
-// p.Lookup("T") T
-// .Type().Underlying().Method(0). f
-// .Type().Results().At(1) b
-// .Type().Field(0) X
+// p.Lookup("T") T
+// .Type().Underlying().Method(0). f
+// .Type().Results().At(1) b
+// .Type().Field(0) X
//
// The encoding is not maximally compact---every R or P is
// followed by an A, for example---but this simplifies the
// encoder and decoder.
-//
const (
// object->type operators
opType = '.' // .Type() (Object)
@@ -136,10 +137,10 @@
//
// For(X) would return a path that denotes the following sequence of operations:
//
-// p.Scope().Lookup("T") (TypeName T)
-// .Type().Underlying().Method(0). (method Func f)
-// .Type().Results().At(1) (field Var b)
-// .Type().Field(0) (field Var X)
+// p.Scope().Lookup("T") (TypeName T)
+// .Type().Underlying().Method(0). (method Func f)
+// .Type().Results().At(1) (field Var b)
+// .Type().Field(0) (field Var X)
//
// where p is the package (*types.Package) to which X belongs.
func For(obj types.Object) (Path, error) {
diff --git a/go/types/typeutil/imports.go b/go/types/typeutil/imports.go
index 9c441db..b81ce0c 100644
--- a/go/types/typeutil/imports.go
+++ b/go/types/typeutil/imports.go
@@ -12,7 +12,6 @@
// package Q, Q appears earlier than P in the result.
// The algorithm follows import statements in the order they
// appear in the source code, so the result is a total order.
-//
func Dependencies(pkgs ...*types.Package) []*types.Package {
var result []*types.Package
seen := make(map[*types.Package]bool)
diff --git a/go/types/typeutil/map.go b/go/types/typeutil/map.go
index c9f8f25..dcc029b 100644
--- a/go/types/typeutil/map.go
+++ b/go/types/typeutil/map.go
@@ -24,7 +24,6 @@
// Just as with map[K]V, a nil *Map is a valid empty map.
//
// Not thread-safe.
-//
type Map struct {
hasher Hasher // shared by many Maps
table map[uint32][]entry // maps hash to bucket; entry.key==nil means unused
@@ -57,14 +56,12 @@
//
// If SetHasher is not called, the Map will create a private hasher at
// the first call to Insert.
-//
func (m *Map) SetHasher(hasher Hasher) {
m.hasher = hasher
}
// Delete removes the entry with the given key, if any.
// It returns true if the entry was found.
-//
func (m *Map) Delete(key types.Type) bool {
if m != nil && m.table != nil {
hash := m.hasher.Hash(key)
@@ -84,7 +81,6 @@
// At returns the map entry for the given key.
// The result is nil if the entry is not present.
-//
func (m *Map) At(key types.Type) interface{} {
if m != nil && m.table != nil {
for _, e := range m.table[m.hasher.Hash(key)] {
@@ -145,7 +141,6 @@
// f will not be invoked for it, but if f inserts a map entry that
// Iterate has not yet reached, whether or not f will be invoked for
// it is unspecified.
-//
func (m *Map) Iterate(f func(key types.Type, value interface{})) {
if m != nil {
for _, bucket := range m.table {
@@ -190,14 +185,12 @@
// String returns a string representation of the map's entries.
// Values are printed using fmt.Sprintf("%v", v).
// Order is unspecified.
-//
func (m *Map) String() string {
return m.toString(true)
}
// KeysString returns a string representation of the map's key set.
// Order is unspecified.
-//
func (m *Map) KeysString() string {
return m.toString(false)
}
diff --git a/go/types/typeutil/methodsetcache.go b/go/types/typeutil/methodsetcache.go
index 3208461..a5d9310 100644
--- a/go/types/typeutil/methodsetcache.go
+++ b/go/types/typeutil/methodsetcache.go
@@ -25,7 +25,6 @@
// If cache is nil, this function is equivalent to types.NewMethodSet(T).
// Utility functions can thus expose an optional *MethodSetCache
// parameter to clients that care about performance.
-//
func (cache *MethodSetCache) MethodSet(T types.Type) *types.MethodSet {
if cache == nil {
return types.NewMethodSet(T)
diff --git a/go/types/typeutil/ui.go b/go/types/typeutil/ui.go
index 9849c24..fa55b0a 100644
--- a/go/types/typeutil/ui.go
+++ b/go/types/typeutil/ui.go
@@ -22,7 +22,6 @@
// this function is intended only for user interfaces.
//
// The order of the result is as for types.MethodSet(T).
-//
func IntuitiveMethodSet(T types.Type, msets *MethodSetCache) []*types.Selection {
isPointerToConcrete := func(T types.Type) bool {
ptr, ok := T.(*types.Pointer)
diff --git a/go/vcs/vcs.go b/go/vcs/vcs.go
index f2aac1c..54d8505 100644
--- a/go/vcs/vcs.go
+++ b/go/vcs/vcs.go
@@ -11,7 +11,6 @@
// for developers who want to write tools with similar semantics.
// It needs to be manually kept in sync with upstream when changes are
// made to cmd/go/internal/get; see https://golang.org/issue/11490.
-//
package vcs // import "golang.org/x/tools/go/vcs"
import (
diff --git a/godoc/analysis/analysis.go b/godoc/analysis/analysis.go
index de8e470..54611e8 100644
--- a/godoc/analysis/analysis.go
+++ b/godoc/analysis/analysis.go
@@ -39,7 +39,6 @@
// ERRORS: for each locus of a frontend (scanner/parser/type) error, the
// location is highlighted in red and hover text provides the compiler
// error message.
-//
package analysis // import "golang.org/x/tools/godoc/analysis"
import (
@@ -160,7 +159,6 @@
// HTML link markup for the specified godoc file URL. Thread-safe.
// Callers must not mutate the elements.
// It returns "zero" if no data is available.
-//
func (res *Result) FileInfo(url string) (fi FileInfo) {
return res.fileInfo(url).get()
}
@@ -185,7 +183,6 @@
// type info for the specified package. Thread-safe.
// Callers must not mutate its fields.
// PackageInfo returns "zero" if no data is available.
-//
func (res *Result) PackageInfo(importPath string) PackageInfo {
return res.pkgInfo(importPath).get()
}
diff --git a/godoc/dirtrees.go b/godoc/dirtrees.go
index 82c9a06..f6a5ba0 100644
--- a/godoc/dirtrees.go
+++ b/godoc/dirtrees.go
@@ -22,7 +22,6 @@
// Conventional name for directories containing test data.
// Excluded from directory trees.
-//
const testdataDirName = "testdata"
type Directory struct {
@@ -217,7 +216,6 @@
// provided for maxDepth, nodes at larger depths are pruned as well; they
// are assumed to contain package files even if their contents are not known
// (i.e., in this case the tree may contain directories w/o any package files).
-//
func (c *Corpus) newDirectory(root string, maxDepth int) *Directory {
// The root could be a symbolic link so use Stat not Lstat.
d, err := c.fs.Stat(root)
@@ -300,7 +298,6 @@
// DirEntry describes a directory entry. The Depth and Height values
// are useful for presenting an entry in an indented fashion.
-//
type DirEntry struct {
Depth int // >= 0
Height int // = DirList.MaxHeight - Depth, > 0
@@ -331,7 +328,6 @@
// If skipRoot is set, the root directory itself is excluded from the list.
// If filter is set, only the directory entries whose paths match the filter
// are included.
-//
func (dir *Directory) listing(skipRoot bool, filter func(string) bool) *DirList {
if dir == nil {
return nil
diff --git a/godoc/format.go b/godoc/format.go
index 3e8c867..eaac8bf 100644
--- a/godoc/format.go
+++ b/godoc/format.go
@@ -25,7 +25,6 @@
// A Segment describes a text segment [start, end).
// The zero value of a Segment is a ready-to-use empty segment.
-//
type Segment struct {
start, end int
}
@@ -36,12 +35,10 @@
// Repeated calls to a selection return consecutive, non-overlapping,
// non-empty segments, followed by an infinite sequence of empty
// segments. The first empty segment marks the end of the selection.
-//
type Selection func() Segment
// A LinkWriter writes some start or end "tag" to w for the text offset offs.
// It is called by FormatSelections at the start or end of each link segment.
-//
type LinkWriter func(w io.Writer, offs int, start bool)
// A SegmentWriter formats a text according to selections and writes it to w.
@@ -49,7 +46,6 @@
// to FormatSelections overlap with the text segment: If the n'th bit is set
// in selections, the n'th selection provided to FormatSelections is overlapping
// with the text.
-//
type SegmentWriter func(w io.Writer, text []byte, selections int)
// FormatSelections takes a text and writes it to w using link and segment
@@ -58,7 +54,6 @@
// consecutive segments of text overlapped by the same selections as specified
// by selections. The link writer lw may be nil, in which case the links
// Selection is ignored.
-//
func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection, sw SegmentWriter, selections ...Selection) {
// If we have a link writer, make the links
// selection the last entry in selections
@@ -144,7 +139,6 @@
// A merger merges a slice of Selections and produces a sequence of
// consecutive segment change events through repeated next() calls.
-//
type merger struct {
selections []Selection
segments []Segment // segments[i] is the next segment of selections[i]
@@ -169,7 +163,6 @@
// to which the segment belongs, offs is the segment start or end offset
// as determined by the start value. If there are no more segment changes,
// next returns an index value < 0.
-//
func (m *merger) next() (index, offs int, start bool) {
// find the next smallest offset where a segment starts or ends
offs = infinity
@@ -233,7 +226,6 @@
// tokenSelection returns, as a selection, the sequence of
// consecutive occurrences of token sel in the Go src text.
-//
func tokenSelection(src []byte, sel token.Token) Selection {
var s scanner.Scanner
fset := token.NewFileSet()
@@ -257,7 +249,6 @@
// makeSelection is a helper function to make a Selection from a slice of pairs.
// Pairs describing empty segments are ignored.
-//
func makeSelection(matches [][]int) Selection {
i := 0
return func() Segment {
@@ -306,7 +297,6 @@
// bit 0: comments
// bit 1: highlights
// bit 2: selections
-//
var startTags = [][]byte{
/* 000 */ []byte(``),
/* 001 */ []byte(`<span class="comment">`),
@@ -336,16 +326,15 @@
// Consecutive text segments are wrapped in HTML spans (with tags as
// defined by startTags and endTag) as follows:
//
-// - if line >= 0, line number (ln) spans are inserted before each line,
-// starting with the value of line
-// - if the text is Go source, comments get the "comment" span class
-// - each occurrence of the regular expression pattern gets the "highlight"
-// span class
-// - text segments covered by selection get the "selection" span class
+// - if line >= 0, line number (ln) spans are inserted before each line,
+// starting with the value of line
+// - if the text is Go source, comments get the "comment" span class
+// - each occurrence of the regular expression pattern gets the "highlight"
+// span class
+// - text segments covered by selection get the "selection" span class
//
// Comments, highlights, and selections may overlap arbitrarily; the respective
// HTML span classes are specified in the startTags variable.
-//
func FormatText(w io.Writer, text []byte, line int, goSource bool, pattern string, selection Selection) {
var comments, highlights Selection
if goSource {
diff --git a/godoc/godoc.go b/godoc/godoc.go
index a88aa12..7ff2eab 100644
--- a/godoc/godoc.go
+++ b/godoc/godoc.go
@@ -41,8 +41,8 @@
// FuncMap defines template functions used in godoc templates.
//
// Convention: template function names ending in "_html" or "_url" produce
-// HTML- or URL-escaped strings; all other function results may
-// require explicit escaping in the template.
+// HTML- or URL-escaped strings; all other function results may
+// require explicit escaping in the template.
func (p *Presentation) FuncMap() template.FuncMap {
p.initFuncMapOnce.Do(p.initFuncMap)
return p.funcMap
diff --git a/godoc/index.go b/godoc/index.go
index f6de201..d3f9f64 100644
--- a/godoc/index.go
+++ b/godoc/index.go
@@ -1359,7 +1359,6 @@
// LookupRegexp returns the number of matches and the matches where a regular
// expression r is found in the full text index. At most n matches are
// returned (thus found <= n).
-//
func (x *Index) LookupRegexp(r *regexp.Regexp, n int) (found int, result []FileLines) {
if x.suffixes == nil || n <= 0 {
return
@@ -1431,7 +1430,6 @@
// feedDirnames feeds the directory names of all directories
// under the file system given by root to channel c.
-//
func (c *Corpus) feedDirnames(ch chan<- string) {
if dir, _ := c.fsTree.Get(); dir != nil {
for d := range dir.(*Directory).iter(false) {
@@ -1442,7 +1440,6 @@
// fsDirnames() returns a channel sending all directory names
// of all the file systems under godoc's observation.
-//
func (c *Corpus) fsDirnames() <-chan string {
ch := make(chan string, 256) // buffered for fewer context switches
go func() {
diff --git a/godoc/linkify.go b/godoc/linkify.go
index 4a9c506..cf266d0 100644
--- a/godoc/linkify.go
+++ b/godoc/linkify.go
@@ -26,7 +26,6 @@
// not being declared), are wrapped with HTML links pointing
// to the respective declaration, if possible. Comments are
// formatted the same way as with FormatText.
-//
func LinkifyText(w io.Writer, text []byte, n ast.Node) {
links := linksFor(n)
@@ -75,7 +74,6 @@
// A link describes the (HTML) link information for an identifier.
// The zero value of a link represents "no link".
-//
type link struct {
path, name string // package path, identifier name
isVal bool // identifier is defined in a const or var declaration
@@ -83,7 +81,6 @@
// linksFor returns the list of links for the identifiers used
// by node in the same order as they appear in the source.
-//
func linksFor(node ast.Node) (links []link) {
// linkMap tracks link information for each ast.Ident node. Entries may
// be created out of source order (for example, when we visit a parent
diff --git a/godoc/meta.go b/godoc/meta.go
index 8d3b825..751b72e 100644
--- a/godoc/meta.go
+++ b/godoc/meta.go
@@ -43,7 +43,6 @@
// extractMetadata extracts the Metadata from a byte slice.
// It returns the Metadata value and the remaining data.
// If no metadata is present the original byte slice is returned.
-//
func extractMetadata(b []byte) (meta Metadata, tail []byte, err error) {
tail = b
if !bytes.HasPrefix(b, jsonStart) {
@@ -121,7 +120,6 @@
// MetadataFor returns the *Metadata for a given relative path or nil if none
// exists.
-//
func (c *Corpus) MetadataFor(relpath string) *Metadata {
if m, _ := c.docMetadata.Get(); m != nil {
meta := m.(map[string]*Metadata)
@@ -142,7 +140,6 @@
// refreshMetadata sends a signal to update DocMetadata. If a refresh is in
// progress the metadata will be refreshed again afterward.
-//
func (c *Corpus) refreshMetadata() {
select {
case c.refreshMetadataSignal <- true:
diff --git a/godoc/server.go b/godoc/server.go
index 9c5d556..57576e1 100644
--- a/godoc/server.go
+++ b/godoc/server.go
@@ -55,7 +55,6 @@
// directory, PageInfo.PAst and PageInfo.PDoc are nil. If there are no sub-
// directories, PageInfo.Dirs is nil. If an error occurred, PageInfo.Err is
// set to the respective error but the error is not logged.
-//
func (h *handlerServer) GetPageInfo(abspath, relpath string, mode PageInfoMode, goos, goarch string) *PageInfo {
info := &PageInfo{Dirname: abspath, Mode: mode}
@@ -411,7 +410,6 @@
// (as is the convention for packages). This is sufficient
// to resolve package identifiers without doing an actual
// import. It never returns an error.
-//
func poorMansImporter(imports map[string]*ast.Object, path string) (*ast.Object, error) {
pkg := imports[path]
if pkg == nil {
@@ -498,7 +496,6 @@
// which correctly updates each package file's comment list.
// (The ast.PackageExports signature is frozen, hence the local
// implementation).
-//
func packageExports(fset *token.FileSet, pkg *ast.Package) {
for _, src := range pkg.Files {
cmap := ast.NewCommentMap(fset, src, src.Comments)
@@ -621,7 +618,6 @@
// formatGoSource HTML-escapes Go source text and writes it to w,
// decorating it with the specified analysis links.
-//
func formatGoSource(buf *bytes.Buffer, text []byte, links []analysis.Link, pattern string, selection Selection) {
// Emit to a temp buffer so that we can add line anchors at the end.
saved, buf := buf, new(bytes.Buffer)
diff --git a/godoc/spot.go b/godoc/spot.go
index 95ffa4b..4720e5b 100644
--- a/godoc/spot.go
+++ b/godoc/spot.go
@@ -13,9 +13,8 @@
//
// The following encoding is used:
//
-// bits 32 4 1 0
-// value [lori|kind|isIndex]
-//
+// bits 32 4 1 0
+// value [lori|kind|isIndex]
type SpotInfo uint32
// SpotKind describes whether an identifier is declared (and what kind of
diff --git a/godoc/util/throttle.go b/godoc/util/throttle.go
index 53d9ba6..7852a32 100644
--- a/godoc/util/throttle.go
+++ b/godoc/util/throttle.go
@@ -8,7 +8,6 @@
// A Throttle permits throttling of a goroutine by
// calling the Throttle method repeatedly.
-//
type Throttle struct {
f float64 // f = (1-r)/r for 0 < r < 1
dt time.Duration // minimum run time slice; >= 0
@@ -27,7 +26,6 @@
// approx. 60% of the time, and sleeps approx. 40% of the time.
// Values of r < 0 or r > 1 are clamped down to values between 0 and 1.
// Values of dt < 0 are set to 0.
-//
func NewThrottle(r float64, dt time.Duration) *Throttle {
var f float64
switch {
@@ -49,7 +47,6 @@
// accumulated run (tr) and sleep times (ts) approximates the value 1/(1-r)
// where r is the throttle value. Throttle returns immediately (w/o sleeping)
// if less than tm ns have passed since the last call to Throttle.
-//
func (p *Throttle) Throttle() {
if p.f < 0 {
select {} // always sleep
diff --git a/godoc/vfs/namespace.go b/godoc/vfs/namespace.go
index 32c8259..23dd979 100644
--- a/godoc/vfs/namespace.go
+++ b/godoc/vfs/namespace.go
@@ -97,7 +97,6 @@
// mount table entries always have old == "/src/pkg"). The 'old' field is
// useful to callers, because they receive just a []mountedFS and not any
// other indication of which mount point was found.
-//
type NameSpace map[string][]mountedFS
// A mountedFS handles requests for path by replacing
@@ -294,7 +293,6 @@
// to find that subdirectory, because we've mounted d:\Work1 and d:\Work2
// there. So if we don't see "src" in the directory listing for c:\Go, we add an
// entry for it before returning.
-//
func (ns NameSpace) ReadDir(path string) ([]os.FileInfo, error) {
path = ns.clean(path)
diff --git a/godoc/vfs/zipfs/zipfs.go b/godoc/vfs/zipfs/zipfs.go
index a82febe..14c9820 100644
--- a/godoc/vfs/zipfs/zipfs.go
+++ b/godoc/vfs/zipfs/zipfs.go
@@ -7,14 +7,14 @@
//
// Assumptions:
//
-// - The file paths stored in the zip file must use a slash ('/') as path
-// separator; and they must be relative (i.e., they must not start with
-// a '/' - this is usually the case if the file was created w/o special
-// options).
-// - The zip file system treats the file paths found in the zip internally
-// like absolute paths w/o a leading '/'; i.e., the paths are considered
-// relative to the root of the file system.
-// - All path arguments to file system methods must be absolute paths.
+// - The file paths stored in the zip file must use a slash ('/') as path
+// separator; and they must be relative (i.e., they must not start with
+// a '/' - this is usually the case if the file was created w/o special
+// options).
+// - The zip file system treats the file paths found in the zip internally
+// like absolute paths w/o a leading '/'; i.e., the paths are considered
+// relative to the root of the file system.
+// - All path arguments to file system methods must be absolute paths.
package zipfs // import "golang.org/x/tools/godoc/vfs/zipfs"
import (
diff --git a/imports/forward.go b/imports/forward.go
index 8be18a6..d2547c7 100644
--- a/imports/forward.go
+++ b/imports/forward.go
@@ -40,7 +40,7 @@
//
// Note that filename's directory influences which imports can be chosen,
// so it is important that filename be accurate.
-// To process data ``as if'' it were in filename, pass the data as a non-nil src.
+// To process data “as if” it were in filename, pass the data as a non-nil src.
func Process(filename string, src []byte, opt *Options) ([]byte, error) {
var err error
if src == nil {
diff --git a/internal/apidiff/compatibility.go b/internal/apidiff/compatibility.go
index 6b5ba75..2e32748 100644
--- a/internal/apidiff/compatibility.go
+++ b/internal/apidiff/compatibility.go
@@ -138,13 +138,13 @@
}
// We need to check three things for structs:
-// 1. The set of exported fields must be compatible. This ensures that keyed struct
-// literals continue to compile. (There is no compatibility guarantee for unkeyed
-// struct literals.)
-// 2. The set of exported *selectable* fields must be compatible. This includes the exported
-// fields of all embedded structs. This ensures that selections continue to compile.
-// 3. If the old struct is comparable, so must the new one be. This ensures that equality
-// expressions and uses of struct values as map keys continue to compile.
+// 1. The set of exported fields must be compatible. This ensures that keyed struct
+// literals continue to compile. (There is no compatibility guarantee for unkeyed
+// struct literals.)
+// 2. The set of exported *selectable* fields must be compatible. This includes the exported
+// fields of all embedded structs. This ensures that selections continue to compile.
+// 3. If the old struct is comparable, so must the new one be. This ensures that equality
+// expressions and uses of struct values as map keys continue to compile.
//
// An unexported embedded struct can't appear in a struct literal outside the
// package, so it doesn't have to be present, or have the same name, in the new
diff --git a/internal/event/export/ocagent/wire/metrics.go b/internal/event/export/ocagent/wire/metrics.go
index 4cfdb88..6cb5894 100644
--- a/internal/event/export/ocagent/wire/metrics.go
+++ b/internal/event/export/ocagent/wire/metrics.go
@@ -71,9 +71,12 @@
// OpenCensus service can correctly determine the underlying value type.
// This custom MarshalJSON exists because,
// by default *Point is JSON marshalled as:
-// {"value": {"int64Value": 1}}
+//
+// {"value": {"int64Value": 1}}
+//
// but it should be marshalled as:
-// {"int64Value": 1}
+//
+// {"int64Value": 1}
func (p *Point) MarshalJSON() ([]byte, error) {
if p == nil {
return []byte("null"), nil
@@ -158,9 +161,12 @@
// OpenCensus service can correctly determine the underlying value type.
// This custom MarshalJSON exists because,
// by default BucketOptionsExplicit is JSON marshalled as:
-// {"bounds":[1,2,3]}
+//
+// {"bounds":[1,2,3]}
+//
// but it should be marshalled as:
-// {"explicit":{"bounds":[1,2,3]}}
+//
+// {"explicit":{"bounds":[1,2,3]}}
func (be *BucketOptionsExplicit) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
Explicit *bucketOptionsExplicitAlias `json:"explicit,omitempty"`
diff --git a/internal/fastwalk/fastwalk.go b/internal/fastwalk/fastwalk.go
index 9887f7e..798fe59 100644
--- a/internal/fastwalk/fastwalk.go
+++ b/internal/fastwalk/fastwalk.go
@@ -40,12 +40,12 @@
// If fastWalk returns filepath.SkipDir, the directory is skipped.
//
// Unlike filepath.Walk:
-// * file stat calls must be done by the user.
+// - file stat calls must be done by the user.
// The only provided metadata is the file type, which does not include
// any permission bits.
-// * multiple goroutines stat the filesystem concurrently. The provided
+// - multiple goroutines stat the filesystem concurrently. The provided
// walkFn must be safe for concurrent use.
-// * fastWalk can follow symlinks if walkFn returns the TraverseLink
+// - fastWalk can follow symlinks if walkFn returns the TraverseLink
// sentinel error. It is the walkFn's responsibility to prevent
// fastWalk from going into symlink cycles.
func Walk(root string, walkFn func(path string, typ os.FileMode) error) error {
diff --git a/internal/imports/imports.go b/internal/imports/imports.go
index 2597398..7902672 100644
--- a/internal/imports/imports.go
+++ b/internal/imports/imports.go
@@ -276,11 +276,11 @@
}
// matchSpace reformats src to use the same space context as orig.
-// 1) If orig begins with blank lines, matchSpace inserts them at the beginning of src.
-// 2) matchSpace copies the indentation of the first non-blank line in orig
-// to every non-blank line in src.
-// 3) matchSpace copies the trailing space from orig and uses it in place
-// of src's trailing space.
+// 1. If orig begins with blank lines, matchSpace inserts them at the beginning of src.
+// 2. matchSpace copies the indentation of the first non-blank line in orig
+// to every non-blank line in src.
+// 3. matchSpace copies the trailing space from orig and uses it in place
+// of src's trailing space.
func matchSpace(orig []byte, src []byte) []byte {
before, _, after := cutSpace(orig)
i := bytes.LastIndex(before, []byte{'\n'})
diff --git a/internal/memoize/memoize.go b/internal/memoize/memoize.go
index 0037342..b3f93b6 100644
--- a/internal/memoize/memoize.go
+++ b/internal/memoize/memoize.go
@@ -7,7 +7,6 @@
//
// To use this package, build a store and use it to acquire handles with the
// Bind method.
-//
package memoize
import (
diff --git a/internal/stack/process.go b/internal/stack/process.go
index ac19366..8812de9 100644
--- a/internal/stack/process.go
+++ b/internal/stack/process.go
@@ -96,7 +96,7 @@
s.Calls[index].merge(gr)
}
-//TODO: do we want other grouping strategies?
+// TODO: do we want other grouping strategies?
func (c *Call) merge(gr Goroutine) {
for i := range c.Groups {
canditate := &c.Groups[i]
diff --git a/internal/stack/stacktest/stacktest.go b/internal/stack/stacktest/stacktest.go
index e23f03e..d778d3c 100644
--- a/internal/stack/stacktest/stacktest.go
+++ b/internal/stack/stacktest/stacktest.go
@@ -11,7 +11,7 @@
"golang.org/x/tools/internal/stack"
)
-//this is only needed to support pre 1.14 when testing.TB did not have Cleanup
+// this is only needed to support pre 1.14 when testing.TB did not have Cleanup
type withCleanup interface {
Cleanup(func())
}
diff --git a/internal/testenv/testenv.go b/internal/testenv/testenv.go
index b381232..d3f4776 100644
--- a/internal/testenv/testenv.go
+++ b/internal/testenv/testenv.go
@@ -222,7 +222,7 @@
NeedsGoPackages(t)
}
-// NeedsGoBuild skips t if the current system can't build programs with ``go build''
+// NeedsGoBuild skips t if the current system can't build programs with “go build”
// and then run them with os.StartProcess or exec.Command.
// android, and darwin/arm systems don't have the userspace go build needs to run,
// and js/wasm doesn't support running subprocesses.
diff --git a/internal/typeparams/common.go b/internal/typeparams/common.go
index ab6b30b..f7678d3 100644
--- a/internal/typeparams/common.go
+++ b/internal/typeparams/common.go
@@ -121,15 +121,15 @@
//
// For example, consider the following type declarations:
//
-// type Interface[T any] interface {
-// Accept(T)
-// }
+// type Interface[T any] interface {
+// Accept(T)
+// }
//
-// type Container[T any] struct {
-// Element T
-// }
+// type Container[T any] struct {
+// Element T
+// }
//
-// func (c Container[T]) Accept(t T) { c.Element = t }
+// func (c Container[T]) Accept(t T) { c.Element = t }
//
// In this case, GenericAssignableTo reports that instantiations of Container
// are assignable to the corresponding instantiation of Interface.
diff --git a/internal/typeparams/example/findtypeparams/main.go b/internal/typeparams/example/findtypeparams/main.go
index 0fe8011..b3f10c0 100644
--- a/internal/typeparams/example/findtypeparams/main.go
+++ b/internal/typeparams/example/findtypeparams/main.go
@@ -36,7 +36,7 @@
//!-input
`
func PrintTypeParams(fset *token.FileSet, file *ast.File) error {
conf := types.Config{Importer: importer.Default()}
info := &types.Info{
diff --git a/internal/typeparams/normalize.go b/internal/typeparams/normalize.go
index 090f142..9c631b6 100644
--- a/internal/typeparams/normalize.go
+++ b/internal/typeparams/normalize.go
@@ -24,20 +24,22 @@
// Structural type restrictions of a type parameter are created via
// non-interface types embedded in its constraint interface (directly, or via a
// chain of interface embeddings). For example, in the declaration
-// type T[P interface{~int; m()}] int
+//
+// type T[P interface{~int; m()}] int
+//
// the structural restriction of the type parameter P is ~int.
//
// With interface embedding and unions, the specification of structural type
// restrictions may be arbitrarily complex. For example, consider the
// following:
//
-// type A interface{ ~string|~[]byte }
+// type A interface{ ~string|~[]byte }
//
-// type B interface{ int|string }
+// type B interface{ int|string }
//
-// type C interface { ~string|~int }
+// type C interface { ~string|~int }
//
-// type T[P interface{ A|B; C }] int
+// type T[P interface{ A|B; C }] int
//
// In this example, the structural type restriction of P is ~string|int: A|B
// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int,
diff --git a/internal/typeparams/typeterm.go b/internal/typeparams/typeterm.go
index 7ddee28..7350bb7 100644
--- a/internal/typeparams/typeterm.go
+++ b/internal/typeparams/typeterm.go
@@ -10,11 +10,10 @@
// A term describes elementary type sets:
//
-// ∅: (*term)(nil) == ∅ // set of no types (empty set)
-// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse)
-// T: &term{false, T} == {T} // set of type T
-// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t
-//
+// ∅: (*term)(nil) == ∅ // set of no types (empty set)
+// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse)
+// T: &term{false, T} == {T} // set of type T
+// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t
type term struct {
tilde bool // valid if typ != nil
typ types.Type
diff --git a/present/code.go b/present/code.go
index eb91555..f00f1f4 100644
--- a/present/code.go
+++ b/present/code.go
@@ -56,7 +56,9 @@
)
// parseCode parses a code present directive. Its syntax:
-// .code [-numbers] [-edit] <filename> [address] [highlight]
+//
+// .code [-numbers] [-edit] <filename> [address] [highlight]
+//
// The directive may also be ".play" if the snippet is executable.
func parseCode(ctx *Context, sourceFile string, sourceLine int, cmd string) (Elem, error) {
cmd = strings.TrimSpace(cmd)
diff --git a/present/doc.go b/present/doc.go
index b1e3fc4..71f758f 100644
--- a/present/doc.go
+++ b/present/doc.go
@@ -7,7 +7,7 @@
which can be slide presentations as in golang.org/x/tools/cmd/present
or articles as in golang.org/x/blog (the Go blog).
-File Format
+# File Format
Present files begin with a header giving the title of the document
and other metadata, which looks like:
@@ -26,7 +26,9 @@
legacy present markup, described below.
The date line may be written without a time:
+
2 Jan 2006
+
In this case, the time will be interpreted as 10am UTC on that date.
The tags line is a comma-separated list of tags that may be used to categorize
@@ -82,7 +84,7 @@
Other than the commands, the text in a section is interpreted
either as Markdown or as legacy present markup.
-Markdown Syntax
+# Markdown Syntax
Markdown typically means the generic name for a family of similar markup languages.
The specific variant used in present is CommonMark.
@@ -138,7 +140,7 @@
Visit [the Go home page](https://golang.org/).
-Legacy Present Syntax
+# Legacy Present Syntax
Compared to Markdown,
in legacy present
@@ -201,7 +203,7 @@
Links can be included in any text with the form [[url][label]], or
[[url]] to use the URL itself as the label.
-Command Invocations
+# Command Invocations
A number of special commands are available through invocations
in the input text. Each such invocation contains a period as the
@@ -224,38 +226,55 @@
section of the file to display. The address syntax is similar in
its simplest form to that of ed, but comes from sam and is more
general. See
+
https://plan9.io/sys/doc/sam/sam.html Table II
+
for full details. The displayed block is always rounded out to a
full line at both ends.
If no pattern is present, the entire file is displayed.
Any line in the program that ends with the four characters
+
OMIT
+
is deleted from the source before inclusion, making it easy
to write things like
+
.code test.go /START OMIT/,/END OMIT/
+
to find snippets like this
+
tedious_code = boring_function()
// START OMIT
interesting_code = fascinating_function()
// END OMIT
+
and see only this:
+
interesting_code = fascinating_function()
Also, inside the displayed text a line that ends
+
// HL
+
will be highlighted in the display. A highlighting mark may have a
suffix word, such as
+
// HLxxx
+
Such highlights are enabled only if the code invocation ends with
"HL" followed by the word:
+
.code test.go /^type Foo/,/^}/ HLxxx
The .code function may take one or more flags immediately preceding
the filename. This command shows test.go in an editable text area:
+
.code -edit test.go
+
This command shows test.go with line numbers:
+
.code -numbers test.go
play:
@@ -333,7 +352,7 @@
.html file.html
-Presenter Notes
+# Presenter Notes
Lines that begin with ": " are treated as presenter notes,
in both Markdown and legacy present syntax.
@@ -347,7 +366,7 @@
Notes may appear anywhere within the slide text. For example:
- * Title of slide
+ ## Title of slide
Some text.
@@ -356,6 +375,5 @@
Some more text.
: Presenter notes (subsequent paragraph(s))
-
*/
package present // import "golang.org/x/tools/present"
diff --git a/refactor/eg/eg.go b/refactor/eg/eg.go
index 0cd1937..15dfbd6 100644
--- a/refactor/eg/eg.go
+++ b/refactor/eg/eg.go
@@ -157,7 +157,6 @@
// a single-file package containing "before" and "after" functions as
// described in the package documentation.
// tmplInfo is the type information for tmplFile.
-//
func NewTransformer(fset *token.FileSet, tmplPkg *types.Package, tmplFile *ast.File, tmplInfo *types.Info, verbose bool) (*Transformer, error) {
// Check the template.
beforeSig := funcSig(tmplPkg, "before")
diff --git a/refactor/eg/match.go b/refactor/eg/match.go
index 89c0f8d..31f8af2 100644
--- a/refactor/eg/match.go
+++ b/refactor/eg/match.go
@@ -27,7 +27,6 @@
//
// A wildcard appearing more than once in the pattern must
// consistently match the same tree.
-//
func (tr *Transformer) matchExpr(x, y ast.Expr) bool {
if x == nil && y == nil {
return true
diff --git a/refactor/eg/rewrite.go b/refactor/eg/rewrite.go
index 1c3ee61..3f71c53 100644
--- a/refactor/eg/rewrite.go
+++ b/refactor/eg/rewrite.go
@@ -77,7 +77,6 @@
// available in info.
//
// Derived from rewriteFile in $GOROOT/src/cmd/gofmt/rewrite.go.
-//
func (tr *Transformer) Transform(info *types.Info, pkg *types.Package, file *ast.File) int {
if !tr.seenInfos[info] {
tr.seenInfos[info] = true
diff --git a/refactor/rename/check.go b/refactor/rename/check.go
index 838fc7b..7a0627b 100644
--- a/refactor/rename/check.go
+++ b/refactor/rename/check.go
@@ -206,7 +206,6 @@
//
// Removing the old name (and all references to it) is always safe, and
// requires no checks.
-//
func (r *renamer) checkInLexicalScope(from types.Object, info *loader.PackageInfo) {
b := from.Parent() // the block defining the 'from' object
if b != nil {
@@ -568,13 +567,14 @@
// checkMethod performs safety checks for renaming a method.
// There are three hazards:
-// - declaration conflicts
-// - selection ambiguity/changes
-// - entailed renamings of assignable concrete/interface types.
-// We reject renamings initiated at concrete methods if it would
-// change the assignability relation. For renamings of abstract
-// methods, we rename all methods transitively coupled to it via
-// assignability.
+// - declaration conflicts
+// - selection ambiguity/changes
+// - entailed renamings of assignable concrete/interface types.
+//
+// We reject renamings initiated at concrete methods if it would
+// change the assignability relation. For renamings of abstract
+// methods, we rename all methods transitively coupled to it via
+// assignability.
func (r *renamer) checkMethod(from *types.Func) {
// e.g. error.Error
if from.Pkg() == nil {
diff --git a/refactor/rename/spec.go b/refactor/rename/spec.go
index 0c4526d..22a268a 100644
--- a/refactor/rename/spec.go
+++ b/refactor/rename/spec.go
@@ -31,7 +31,6 @@
//
// It is populated from an -offset flag or -from query;
// see Usage for the allowed -from query forms.
-//
type spec struct {
// pkg is the package containing the position
// specified by the -from or -offset flag.
@@ -413,7 +412,6 @@
// spec.fromName matching the spec. On success, the result has exactly
// one element unless spec.searchFor!="", in which case it has at least one
// element.
-//
func findObjects(info *loader.PackageInfo, spec *spec) ([]types.Object, error) {
if spec.pkgMember == "" {
if spec.searchFor == "" {
@@ -572,6 +570,7 @@
}
// Matches cgo generated comment as well as the proposed standard:
+//
// https://golang.org/s/generatedcode
var generatedRx = regexp.MustCompile(`// .*DO NOT EDIT\.?`)
diff --git a/refactor/rename/util.go b/refactor/rename/util.go
index e8f8d74..258ba78 100644
--- a/refactor/rename/util.go
+++ b/refactor/rename/util.go
@@ -83,7 +83,6 @@
// sameFile returns true if x and y have the same basename and denote
// the same file.
-//
func sameFile(x, y string) bool {
if runtime.GOOS == "windows" {
x = filepath.ToSlash(x)
diff --git a/refactor/satisfy/find.go b/refactor/satisfy/find.go
index 34b349e..ff4212b 100644
--- a/refactor/satisfy/find.go
+++ b/refactor/satisfy/find.go
@@ -14,7 +14,6 @@
// functionality will become part of the type-checker in due course,
// since it is computing it anyway, and it is robust for ill-typed
// inputs, which this package is not.
-//
package satisfy // import "golang.org/x/tools/refactor/satisfy"
// NOTES:
@@ -69,7 +68,6 @@
// that is checked during compilation of a package. Refactoring tools
// will need to preserve at least this part of the relation to ensure
// continued compilation.
-//
type Finder struct {
Result map[Constraint]bool
msetcache typeutil.MethodSetCache
@@ -88,7 +86,6 @@
// The package must be free of type errors, and
// info.{Defs,Uses,Selections,Types} must have been populated by the
// type-checker.
-//
func (f *Finder) Find(info *types.Info, files []*ast.File) {
if f.Result == nil {
f.Result = make(map[Constraint]bool)
@@ -276,7 +273,6 @@
// explicit conversions and comparisons between two types, unless the
// types are uninteresting (e.g. lhs is a concrete type, or the empty
// interface; rhs has no methods).
-//
func (f *Finder) assign(lhs, rhs types.Type) {
if types.Identical(lhs, rhs) {
return
diff --git a/txtar/archive.go b/txtar/archive.go
index 2142566..81b3145 100644
--- a/txtar/archive.go
+++ b/txtar/archive.go
@@ -6,15 +6,15 @@
//
// The goals for the format are:
//
-// - be trivial enough to create and edit by hand.
-// - be able to store trees of text files describing go command test cases.
-// - diff nicely in git history and code reviews.
+// - be trivial enough to create and edit by hand.
+// - be able to store trees of text files describing go command test cases.
+// - diff nicely in git history and code reviews.
//
// Non-goals include being a completely general archive format,
// storing binary data, storing file modes, storing special files like
// symbolic links, and so on.
//
-// Txtar format
+// # Txtar format
//
// A txtar archive is zero or more comment lines and then a sequence of file entries.
// Each file entry begins with a file marker line of the form "-- FILENAME --"
To view, visit change 399363. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ic98f647623f234cf5d36309c6204683e151820d7
Reviewed-on: https://go-review.googlesource.com/c/example/+/399596
Run-TryBot: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M gotypes/defsuses/main.go
M gotypes/hello/hello.go
M gotypes/hugeparam/main.go
M gotypes/implements/main.go
M gotypes/lookup/lookup.go
M gotypes/nilfunc/main.go
M gotypes/pkginfo/main.go
M gotypes/skeleton/main.go
M gotypes/typeandvalue/main.go
M gotypes/weave.go
10 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/gotypes/defsuses/main.go b/gotypes/defsuses/main.go
index 5347f48..bdddc6c 100644
--- a/gotypes/defsuses/main.go
+++ b/gotypes/defsuses/main.go
@@ -19,7 +19,7 @@
}
`
-//!+
+// !+
func PrintDefsUses(fset *token.FileSet, files ...*ast.File) error {
conf := types.Config{Importer: importer.Default()}
info := &types.Info{
diff --git a/gotypes/hello/hello.go b/gotypes/hello/hello.go
index 01a2862..431bcc1 100644
--- a/gotypes/hello/hello.go
+++ b/gotypes/hello/hello.go
@@ -1,4 +1,4 @@
-//!+
+// !+
package main
import "fmt"
diff --git a/gotypes/hugeparam/main.go b/gotypes/hugeparam/main.go
index 1474403..80fc47e 100644
--- a/gotypes/hugeparam/main.go
+++ b/gotypes/hugeparam/main.go
@@ -1,6 +1,7 @@
// The hugeparam command identifies by-value parameters that are larger than n bytes.
//
// Example:
+//
// $ ./hugeparams encoding/xml
package main
@@ -15,7 +16,7 @@
"golang.org/x/tools/go/loader"
)
-//!+
+// !+
var bytesFlag = flag.Int("bytes", 48, "maximum parameter size in bytes")
var sizeof = (&types.StdSizes{8, 8}).Sizeof // the sizeof function
diff --git a/gotypes/implements/main.go b/gotypes/implements/main.go
index 70b4ee5..5c1fc99 100644
--- a/gotypes/implements/main.go
+++ b/gotypes/implements/main.go
@@ -10,7 +10,7 @@
"log"
)
-//!+input
+// !+input
const input = `package main
type A struct{}
diff --git a/gotypes/lookup/lookup.go b/gotypes/lookup/lookup.go
index 4313e2e..074eb72 100644
--- a/gotypes/lookup/lookup.go
+++ b/gotypes/lookup/lookup.go
@@ -11,7 +11,7 @@
"strings"
)
-//!+input
+// !+input
const hello = `
package main
@@ -32,7 +32,7 @@
//!-input
-//!+main
+// !+main
func main() {
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "hello.go", hello, parser.ParseComments)
diff --git a/gotypes/nilfunc/main.go b/gotypes/nilfunc/main.go
index 2dbb19c..1e976d9 100644
--- a/gotypes/nilfunc/main.go
+++ b/gotypes/nilfunc/main.go
@@ -10,7 +10,7 @@
"log"
)
-//!+input
+// !+input
const input = `package main
import "bytes"
@@ -50,7 +50,7 @@
})
}
-//!+
+// !+
// CheckNilFuncComparison reports unintended comparisons
// of functions against nil, e.g., "if x.Method == nil {".
func CheckNilFuncComparison(info *types.Info, n ast.Node) {
diff --git a/gotypes/pkginfo/main.go b/gotypes/pkginfo/main.go
index 957e01b..15dbf10 100644
--- a/gotypes/pkginfo/main.go
+++ b/gotypes/pkginfo/main.go
@@ -1,4 +1,4 @@
-//!+
+// !+
package main
import (
diff --git a/gotypes/skeleton/main.go b/gotypes/skeleton/main.go
index c3961e2..1e6ee82 100644
--- a/gotypes/skeleton/main.go
+++ b/gotypes/skeleton/main.go
@@ -2,6 +2,7 @@
// that implements the specified interface type.
//
// Example:
+//
// $ ./skeleton io ReadWriteCloser buffer
// // *buffer implements io.ReadWriteCloser.
// type buffer struct{ /* ... */ }
@@ -24,7 +25,7 @@
const usage = "Usage: skeleton <package> <interface> <concrete>"
-//!+
+// !+
func PrintSkeleton(pkg *types.Package, ifacename, concname string) error {
obj := pkg.Scope().Lookup(ifacename)
if obj == nil {
diff --git a/gotypes/typeandvalue/main.go b/gotypes/typeandvalue/main.go
index 7b3b553..c7fb8ed 100644
--- a/gotypes/typeandvalue/main.go
+++ b/gotypes/typeandvalue/main.go
@@ -12,7 +12,7 @@
"log"
)
-//!+input
+// !+input
const input = `
package main
diff --git a/gotypes/weave.go b/gotypes/weave.go
index cfaa57b..bf8264a 100644
--- a/gotypes/weave.go
+++ b/gotypes/weave.go
@@ -2,7 +2,8 @@
// It builds a table of contents and processes %include directives.
//
// Example usage:
-// $ go run weave.go go-types.md > README.md
+//
+// $ go run weave.go go-types.md > README.md
package main
import (
To view, visit change 399596. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Ia404739fe81daca82a209ff82fc29ac3a064cea2
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/399595
Run-TryBot: Russ Cox <r...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
TryBot-Result: Gopher Robot <go...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
---
M cmd/bent/bent.go
M driver/driver.go
M driver/driver_darwin.go
M driver/driver_go10.go
M driver/driver_go12.go
M driver/driver_go15.go
M driver/driver_linux.go
M driver/driver_stub.go
M driver/driver_unix.go
M sweet/benchmarks/internal/driver/mem.go
M sweet/benchmarks/internal/pool/pool.go
M third_party/biogo-examples/krishna/krishna.go
12 files changed, 42 insertions(+), 17 deletions(-)
diff --git a/cmd/bent/bent.go b/cmd/bent/bent.go
index 22d681a..ce7e772 100644
--- a/cmd/bent/bent.go
+++ b/cmd/bent/bent.go
@@ -1092,13 +1092,13 @@
}
// checkAndSetUpFileSystem does a number of tasks to ensure that the tests will
-// run properly. It:
+// run properly.
//
-// - Makes sure we're not going to accidentally overwrite previous results
-// - if shouldInit is true, we:
-// - Create a Dockerfile.
-// - Create all the configuration files.
-// - Exit
+// First, it makes sure we're not going to accidentally overwrite previous results.
+// Then, it shouldInit is true, it:
+// - Creates a Dockerfile.
+// - Creates all the configuration files.
+// - Exits.
func checkAndSetUpFileSystem(shouldInit bool) error {
// To avoid bad surprises, look for pkg and bin, if they exist, refuse to run
_, derr := os.Stat("Dockerfile")
diff --git a/driver/driver.go b/driver/driver.go
index b1fb3ad..ba32d3f 100644
--- a/driver/driver.go
+++ b/driver/driver.go
@@ -8,8 +8,8 @@
// benchmark function can do one of two things when invoked:
// 1. Do whatever it wants, fill and return Result object.
// 2. Call Benchmark helper function and provide benchmarking function
-// func(N uint64), similar to standard testing benchmarks. The rest is handled
-// by the driver.
+// func(N uint64), similar to standard testing benchmarks. The rest is handled
+// by the driver.
package driver // import "golang.org/x/benchmarks/driver"
import (
diff --git a/driver/driver_darwin.go b/driver/driver_darwin.go
index 19e3670..24c11d5 100644
--- a/driver/driver_darwin.go
+++ b/driver/driver_darwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !linux
// +build !linux
package driver
diff --git a/driver/driver_go10.go b/driver/driver_go10.go
index 2874b98..6d6c81b 100644
--- a/driver/driver_go10.go
+++ b/driver/driver_go10.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !go1.2
// +build !go1.2
package driver
diff --git a/driver/driver_go12.go b/driver/driver_go12.go
index 7a99810..02f5ecc 100644
--- a/driver/driver_go12.go
+++ b/driver/driver_go12.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.2
// +build go1.2
package driver
diff --git a/driver/driver_go15.go b/driver/driver_go15.go
index f6cd9ca..73e0e33 100644
--- a/driver/driver_go15.go
+++ b/driver/driver_go15.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.5
// +build go1.5
package driver
diff --git a/driver/driver_linux.go b/driver/driver_linux.go
index b73ad6a..4012aeb 100644
--- a/driver/driver_linux.go
+++ b/driver/driver_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package driver
diff --git a/driver/driver_stub.go b/driver/driver_stub.go
index 6f68af9..38e17b3 100644
--- a/driver/driver_stub.go
+++ b/driver/driver_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || dragonfly || freebsd || netbsd || openbsd || solaris
// +build aix dragonfly freebsd netbsd openbsd solaris
package driver
diff --git a/driver/driver_unix.go b/driver/driver_unix.go
index 2a35e7b..bc5c2fb 100644
--- a/driver/driver_unix.go
+++ b/driver/driver_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package driver
diff --git a/sweet/benchmarks/internal/driver/mem.go b/sweet/benchmarks/internal/driver/mem.go
index 6063ebe..eee457e 100644
--- a/sweet/benchmarks/internal/driver/mem.go
+++ b/sweet/benchmarks/internal/driver/mem.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !linux
// +build !linux
package driver
diff --git a/sweet/benchmarks/internal/pool/pool.go b/sweet/benchmarks/internal/pool/pool.go
index b35e447..d7ce705 100644
--- a/sweet/benchmarks/internal/pool/pool.go
+++ b/sweet/benchmarks/internal/pool/pool.go
@@ -3,16 +3,16 @@
// license that can be found in the LICENSE file.
/*
- This package provides a facility to run a heterogeneous pool of workers.
+This package provides a facility to run a heterogeneous pool of workers.
- Each worker is defined by an interface, and the pool execute's each worker's
- Run method repeatedly concurrently. The worker may exit early by returning
- the Done error. Each worker's Run method accepts a context.Context which is
- passed to it through the pool. If this context is cancelled, it may cancel
- workers and will always cancel the pool.
+Each worker is defined by an interface, and the pool execute's each worker's
+Run method repeatedly concurrently. The worker may exit early by returning
+the Done error. Each worker's Run method accepts a context.Context which is
+passed to it through the pool. If this context is cancelled, it may cancel
+workers and will always cancel the pool.
- Each worker is guaranteed to start immediately when the pool's Run method is
- called and not any sooner.
+Each worker is guaranteed to start immediately when the pool's Run method is
+called and not any sooner.
*/
package pool
diff --git a/third_party/biogo-examples/krishna/krishna.go b/third_party/biogo-examples/krishna/krishna.go
index 01b5bc9..7c37a63 100644
--- a/third_party/biogo-examples/krishna/krishna.go
+++ b/third_party/biogo-examples/krishna/krishna.go
@@ -57,7 +57,6 @@
return &Krishna{params, target, pa}, nil
}
-//
// Returns a cleanup function, and an error. The cleanup function should be
// called before program exit, if not nil.
func (k *Krishna) Run(writer *pals.Writer) error {
To view, visit change 399595. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: internal/importers/java/java.go
Insertions: 14, Deletions: 22.
@@ -408,37 +408,29 @@
// fillSuperSigs combines methods signatures with super class signatures,
// to preserve the assignability of classes to their super classes.
//
-// # For example, the class
+// For example, the class
//
-// class A {
-//
-// void f();
-//
-// }
+// class A {
+// void f();
+// }
//
// is by itself represented by the Go interface
//
-// type A interface {
+// type A interface {
+// f()
+// }
//
-// f()
+// However, if class
//
-// }
-//
-// # However, if class
-//
-// class B extends A {
-//
-// void f(int);
-//
-// }
+// class B extends A {
+// void f(int);
+// }
//
// is also imported, it will be represented as
//
-// type B interface {
-//
-// f(...int32)
-//
-// }
+// type B interface {
+// f(...int32)
+// }
//
// To make Go B assignable to Go A, the signature of A's f must
// be updated to f(...int32) as well.
```
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: I9b4c287e2d25aa108adfa9fe2f972c8fd3d68fe1
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/399597
Run-TryBot: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
---
M app/darwin_desktop.go
M app/doc.go
M app/internal/callfn/callfn.go
M bind/testdata/testpkg/tagged.go
M cmd/gobind/doc.go
M cmd/gomobile/bind_androidapp.go
M cmd/gomobile/build.go
M cmd/gomobile/doc.go
M event/lifecycle/lifecycle.go
M event/paint/paint.go
M example/basic/main.go
M example/network/main.go
M exp/audio/al/al.go
M exp/f32/f32.go
M exp/f32/mat4.go
M exp/sprite/portable/portable.go
M gl/doc.go
M internal/binres/binres.go
M internal/binres/pool.go
M internal/binres/table.go
M internal/importers/ast.go
M internal/importers/java/java.go
22 files changed, 165 insertions(+), 133 deletions(-)
diff --git a/app/darwin_desktop.go b/app/darwin_desktop.go
index 6b9ec94..3377175 100644
--- a/app/darwin_desktop.go
+++ b/app/darwin_desktop.go
@@ -240,6 +240,7 @@
// into the standard keycodes used by the key package.
//
// To get a sense of the key map, see the diagram on
+//
// http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
func convVirtualKeyCode(vkcode uint16) key.Code {
switch vkcode {
diff --git a/app/doc.go b/app/doc.go
index 80e21a0..02bd6db 100644
--- a/app/doc.go
+++ b/app/doc.go
@@ -18,7 +18,7 @@
use this app package to initialize the app, manage its lifecycle, and
receive events.
-Building apps
+# Building apps
Apps written entirely in Go have a main function, and can be built
with `gomobile build`, which directly produces runnable output for
@@ -30,7 +30,7 @@
For detailed instructions and documentation, see
https://golang.org/wiki/Mobile.
-Event processing in Native Apps
+# Event processing in Native Apps
The Go runtime is initialized on Android when NativeActivity onCreate is
called, and on iOS when the process starts. In both cases, Go init functions
@@ -69,17 +69,20 @@
An event is represented by the empty interface type interface{}. Any value can
be an event. Commonly used types include Event types defined by the following
packages:
- - golang.org/x/mobile/event/lifecycle
- - golang.org/x/mobile/event/mouse
- - golang.org/x/mobile/event/paint
- - golang.org/x/mobile/event/size
- - golang.org/x/mobile/event/touch
+ - golang.org/x/mobile/event/lifecycle
+ - golang.org/x/mobile/event/mouse
+ - golang.org/x/mobile/event/paint
+ - golang.org/x/mobile/event/size
+ - golang.org/x/mobile/event/touch
+
For example, touch.Event is the type that represents touch events. Other
packages may define their own events, and send them on an app's event channel.
Other packages can also register event filters, e.g. to manage resources in
response to lifecycle events. Such packages should call:
+
app.RegisterFilter(etc)
+
in an init function inside that package.
*/
package app // import "golang.org/x/mobile/app"
diff --git a/app/internal/callfn/callfn.go b/app/internal/callfn/callfn.go
index 42dd028..7a3d050 100644
--- a/app/internal/callfn/callfn.go
+++ b/app/internal/callfn/callfn.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build android && (arm || 386 || amd64 || arm64)
// +build android
// +build arm 386 amd64 arm64
diff --git a/bind/testdata/testpkg/tagged.go b/bind/testdata/testpkg/tagged.go
index 69ebff0..b5fe898 100644
--- a/bind/testdata/testpkg/tagged.go
+++ b/bind/testdata/testpkg/tagged.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aaa && bbb
// +build aaa,bbb
// This file tests that tags work with gomobile.
diff --git a/cmd/gobind/doc.go b/cmd/gobind/doc.go
index 92f64ac..31155c6 100644
--- a/cmd/gobind/doc.go
+++ b/cmd/gobind/doc.go
@@ -11,7 +11,7 @@
`gomobile bind`. For more details on installing and using the gomobile
tool, see https://golang.org/x/mobile/cmd/gomobile.
-Binding Go
+# Binding Go
Gobind generates target language (Java or Objective-C) bindings for
each exported symbol in a Go package. The Go package you choose to
@@ -24,7 +24,7 @@
with -buildmode=c-archive for iOS or -buildmode=c-shared for Android.
These details are handled by the `gomobile bind` command.
-Passing Go objects to target languages
+# Passing Go objects to target languages
Consider a type for counting:
@@ -85,7 +85,7 @@
The returned GoMypkgCounter* holds a reference to an underlying Go
*Counter.
-Passing target language objects to Go
+# Passing target language objects to Go
For a Go interface:
@@ -125,7 +125,6 @@
Printer printer = new SysPrint();
Myfmt.printHello(printer);
-
For Objective-C binding, gobind generates a protocol that declares
methods corresponding to Go interface's methods.
@@ -154,32 +153,31 @@
SysPrint* printer = [[SysPrint alloc] init];
GoMyfmtPrintHello(printer);
-
-Type restrictions
+# Type restrictions
At present, only a subset of Go types are supported.
All exported symbols in the package must have types that are supported.
Supported types include:
- - Signed integer and floating point types.
+ - Signed integer and floating point types.
- - String and boolean types.
+ - String and boolean types.
- - Byte slice types. Note that byte slices are passed by reference,
- and support mutation.
+ - Byte slice types. Note that byte slices are passed by reference,
+ and support mutation.
- - Any function type all of whose parameters and results have
- supported types. Functions must return either no results,
- one result, or two results where the type of the second is
- the built-in 'error' type.
+ - Any function type all of whose parameters and results have
+ supported types. Functions must return either no results,
+ one result, or two results where the type of the second is
+ the built-in 'error' type.
- - Any interface type, all of whose exported methods have
- supported function types.
+ - Any interface type, all of whose exported methods have
+ supported function types.
- - Any struct type, all of whose exported methods have
- supported function types and all of whose exported fields
- have supported types.
+ - Any struct type, all of whose exported methods have
+ supported function types and all of whose exported fields
+ have supported types.
Unexported symbols have no effect on the cross-language interface, and
as such are not restricted.
@@ -190,8 +188,7 @@
Exceptions and panics are not yet supported. If either pass a language
boundary, the program will exit.
-
-Reverse bindings
+# Reverse bindings
Gobind also supports accessing API from Java or Objective C from Go.
Similar to how Cgo supports the magic "C" import, gobind recognizes
@@ -225,7 +222,7 @@
https://golang.org/issues/16876 (Java) and https://golang.org/issues/17102
(Objective C).
-Avoid reference cycles
+# Avoid reference cycles
The language bindings maintain a reference to each object that has been
proxied. When a proxy object becomes unreachable, its finalizer reports
@@ -246,7 +243,7 @@
references to proxies of objects. That is: if you implement a Go
interface in Java, do not store an instance of Seq.Object inside it.
-Further reading
+# Further reading
Examples can be found in http://golang.org/x/mobile/example.
diff --git a/cmd/gomobile/bind_androidapp.go b/cmd/gomobile/bind_androidapp.go
index 8ae9d4d..7703868 100644
--- a/cmd/gomobile/bind_androidapp.go
+++ b/cmd/gomobile/bind_androidapp.go
@@ -122,7 +122,7 @@
// These entries are directly at the root of the archive.
//
// AndroidManifest.xml (mandatory)
-// classes.jar (mandatory)
+// classes.jar (mandatory)
// assets/ (optional)
// jni/<abi>/libgojni.so
// R.txt (mandatory)
diff --git a/cmd/gomobile/build.go b/cmd/gomobile/build.go
index bd65f1c..a11865a 100644
--- a/cmd/gomobile/build.go
+++ b/cmd/gomobile/build.go
@@ -354,10 +354,11 @@
// parseBuildTarget parses buildTarget into 1 or more platforms and architectures.
// Returns an error if buildTarget contains invalid input.
// Example valid target strings:
-// android
-// android/arm64,android/386,android/amd64
-// ios,iossimulator,maccatalyst
-// macos/amd64
+//
+// android
+// android/arm64,android/386,android/amd64
+// ios,iossimulator,maccatalyst
+// macos/amd64
func parseBuildTarget(buildTarget string) ([]targetInfo, error) {
if buildTarget == "" {
return nil, fmt.Errorf(`invalid target ""`)
diff --git a/cmd/gomobile/doc.go b/cmd/gomobile/doc.go
index 8522dd6..10e3127 100644
--- a/cmd/gomobile/doc.go
+++ b/cmd/gomobile/doc.go
@@ -30,8 +30,7 @@
Use 'gomobile help [command]' for more information about that command.
-
-Build a library for Android and iOS
+# Build a library for Android and iOS
Usage:
@@ -76,8 +75,7 @@
The build flags -a, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work
are shared with the build command. For documentation, see 'go help build'.
-
-Compile android APK and iOS app
+# Compile android APK and iOS app
Usage:
@@ -128,15 +126,13 @@
The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
shared with the build command. For documentation, see 'go help build'.
-
-Remove object files and cached gomobile files
+# Remove object files and cached gomobile files
Usage:
gomobile clean
-Clean removes object files and cached NDK files downloaded by gomobile init
-
+# Clean removes object files and cached NDK files downloaded by gomobile init
Build OpenAL for Android
@@ -148,8 +144,7 @@
build an Android version of OpenAL for use with gomobile build
and gomobile install.
-
-Compile android APK and install on device
+# Compile android APK and install on device
Usage:
@@ -164,8 +159,7 @@
shared with the build command.
For documentation, see 'go help build'.
-
-Print version
+# Print version
Usage:
diff --git a/event/lifecycle/lifecycle.go b/event/lifecycle/lifecycle.go
index 9a5f54e..4c58858 100644
--- a/event/lifecycle/lifecycle.go
+++ b/event/lifecycle/lifecycle.go
@@ -59,9 +59,10 @@
}
// Crosses reports whether the transition from From to To crosses the stage s:
-// - It returns CrossOn if it does, and the lifecycle change is positive.
-// - It returns CrossOff if it does, and the lifecycle change is negative.
-// - Otherwise, it returns CrossNone.
+// - It returns CrossOn if it does, and the lifecycle change is positive.
+// - It returns CrossOff if it does, and the lifecycle change is negative.
+// - Otherwise, it returns CrossNone.
+//
// See the documentation for Stage for more discussion of positive and negative
// crosses.
func (e Event) Crosses(s Stage) Cross {
diff --git a/event/paint/paint.go b/event/paint/paint.go
index b7b4113..0f24b1a 100644
--- a/event/paint/paint.go
+++ b/event/paint/paint.go
@@ -9,7 +9,7 @@
// Event indicates that the app is ready to paint the next frame of the GUI.
//
-//A frame is completed by calling the App's Publish method.
+// A frame is completed by calling the App's Publish method.
type Event struct {
// External is true for paint events sent by the screen driver.
//
diff --git a/example/basic/main.go b/example/basic/main.go
index 697fe21..94932db 100644
--- a/example/basic/main.go
+++ b/example/basic/main.go
@@ -13,19 +13,20 @@
//
// Get the basic example and use gomobile to build or install it on your device.
//
-// $ go get -d golang.org/x/mobile/example/basic
-// $ gomobile build golang.org/x/mobile/example/basic # will build an APK
+// $ go get -d golang.org/x/mobile/example/basic
+// $ gomobile build golang.org/x/mobile/example/basic # will build an APK
//
-// # plug your Android device to your computer or start an Android emulator.
-// # if you have adb installed on your machine, use gomobile install to
-// # build and deploy the APK to an Android target.
-// $ gomobile install golang.org/x/mobile/example/basic
+// # plug your Android device to your computer or start an Android emulator.
+// # if you have adb installed on your machine, use gomobile install to
+// # build and deploy the APK to an Android target.
+// $ gomobile install golang.org/x/mobile/example/basic
//
// Switch to your device or emulator to start the Basic application from
// the launcher.
// You can also run the application on your desktop by running the command
// below. (Note: It currently doesn't work on Windows.)
-// $ go install golang.org/x/mobile/example/basic && basic
+//
+// $ go install golang.org/x/mobile/example/basic && basic
package main
import (
diff --git a/example/network/main.go b/example/network/main.go
index 8375eb0..4b23cbe 100644
--- a/example/network/main.go
+++ b/example/network/main.go
@@ -11,7 +11,7 @@
// In order to access the network from the Android app, its AndroidManifest.xml
// file must include the permission to access the network.
//
-// http://developer.android.com/guide/topics/manifest/manifest-intro.html#perms
+// http://developer.android.com/guide/topics/manifest/manifest-intro.html#perms
//
// The gomobile tool auto-generates a default AndroidManifest file by default
// unless the package directory contains the AndroidManifest.xml. Users can
@@ -25,19 +25,20 @@
//
// Get the network example and use gomobile to build or install it on your device.
//
-// $ go get -d golang.org/x/mobile/example/network
-// $ gomobile build golang.org/x/mobile/example/network # will build an APK
+// $ go get -d golang.org/x/mobile/example/network
+// $ gomobile build golang.org/x/mobile/example/network # will build an APK
//
-// # plug your Android device to your computer or start an Android emulator.
-// # if you have adb installed on your machine, use gomobile install to
-// # build and deploy the APK to an Android target.
-// $ gomobile install golang.org/x/mobile/example/network
+// # plug your Android device to your computer or start an Android emulator.
+// # if you have adb installed on your machine, use gomobile install to
+// # build and deploy the APK to an Android target.
+// $ gomobile install golang.org/x/mobile/example/network
//
// Switch to your device or emulator to start the network application from
// the launcher.
// You can also run the application on your desktop by running the command
// below. (Note: It currently doesn't work on Windows.)
-// $ go install golang.org/x/mobile/example/network && network
+//
+// $ go install golang.org/x/mobile/example/network && network
package main
import (
diff --git a/exp/audio/al/al.go b/exp/audio/al/al.go
index bcddeef..b2396a5 100644
--- a/exp/audio/al/al.go
+++ b/exp/audio/al/al.go
@@ -17,7 +17,7 @@
// On Ubuntu 14.04 'Trusty', you may have to install this library
// by running the command below.
//
-// sudo apt-get install libopenal-dev
+// sudo apt-get install libopenal-dev
//
// When compiled for Android, this package uses OpenAL Soft. Please add its
// license file to the open source notices of your application.
diff --git a/exp/f32/f32.go b/exp/f32/f32.go
index d794398..59e1b65 100644
--- a/exp/f32/f32.go
+++ b/exp/f32/f32.go
@@ -18,7 +18,7 @@
// It is safe to use the destination address as the left-hand side,
// that is, dst *= rhs is dst.Mul(dst, rhs).
//
-// WARNING
+// # WARNING
//
// The interface to this package is not stable. It will change considerably.
// Only use functions that provide package documentation. Semantics are
diff --git a/exp/f32/mat4.go b/exp/f32/mat4.go
index 75d3a59..ffa1a8f 100644
--- a/exp/f32/mat4.go
+++ b/exp/f32/mat4.go
@@ -92,6 +92,7 @@
// Scale sets m to be a scale followed by p.
// It is equivalent to
+//
// m.Mul(p, &Mat4{
// {x, 0, 0, 0},
// {0, y, 0, 0},
@@ -119,6 +120,7 @@
// Translate sets m to be a translation followed by p.
// It is equivalent to
+//
// m.Mul(p, &Mat4{
// {1, 0, 0, x},
// {0, 1, 0, y},
diff --git a/exp/sprite/portable/portable.go b/exp/sprite/portable/portable.go
index 66b9f79..28925d1 100644
--- a/exp/sprite/portable/portable.go
+++ b/exp/sprite/portable/portable.go
@@ -154,14 +154,14 @@
// affine draws each pixel of dst using bilinear interpolation of the
// affine-transformed position in src. This is equivalent to:
//
-// for each (x,y) in dst:
-// dst(x,y) = bilinear interpolation of src(a*(x,y))
+// for each (x,y) in dst:
+// dst(x,y) = bilinear interpolation of src(a*(x,y))
//
// While this is the simpler implementation, it can be counter-
// intuitive as an affine transformation is usually described in terms
// of the source, not the destination. For example, a scale transform
//
-// Affine{{2, 0, 0}, {0, 2, 0}}
+// Affine{{2, 0, 0}, {0, 2, 0}}
//
// will produce a dst that is half the size of src. To perform a
// traditional affine transform, use the inverse of the affine matrix.
diff --git a/gl/doc.go b/gl/doc.go
index 1eb1d77..880d5f9 100644
--- a/gl/doc.go
+++ b/gl/doc.go
@@ -22,7 +22,7 @@
One notable departure from the C API is the introduction of types
to represent common uses of GLint: Texture, Surface, Buffer, etc.
-Debug Logging
+# Debug Logging
A tracing version of the OpenGL bindings is behind the `gldebug` build
tag. It acts as a simplified version of apitrace. Build your Go binary
diff --git a/internal/binres/binres.go b/internal/binres/binres.go
index 8673063..78b874f 100644
--- a/internal/binres/binres.go
+++ b/internal/binres/binres.go
@@ -12,9 +12,9 @@
// sent to unmarshalling. This allows tests to validate each struct representation
// of the binary format as follows:
//
-// * unmarshal the output of aapt
-// * marshal the struct representation
-// * perform byte-to-byte comparison with aapt output per chunk header and body
+// - unmarshal the output of aapt
+// - marshal the struct representation
+// - perform byte-to-byte comparison with aapt output per chunk header and body
//
// This process should strive to make structs idiomatic to make parsing xml text
// into structs trivial.
@@ -22,9 +22,9 @@
// Once the struct representation is validated, tests for parsing xml text
// into structs can become self-referential as the following holds true:
//
-// * the unmarshalled input of aapt output is the only valid target
-// * the unmarshalled input of xml text may be compared to the unmarshalled
-// input of aapt output to identify errors, e.g. text-trims, wrong flags, etc
+// - the unmarshalled input of aapt output is the only valid target
+// - the unmarshalled input of xml text may be compared to the unmarshalled
+// input of aapt output to identify errors, e.g. text-trims, wrong flags, etc
//
// This provides validation, byte-for-byte, for producing binary xml resources.
//
@@ -34,11 +34,11 @@
//
// A simple view of binary xml document structure:
//
-// XML
-// Pool
-// Map
-// Namespace
-// [...node]
+// XML
+// Pool
+// Map
+// Namespace
+// [...node]
//
// Additional resources:
// https://android.googlesource.com/platform/frameworks/base/+/master/libs/androidfw/include/androidfw/ResourceTypes.h
diff --git a/internal/binres/pool.go b/internal/binres/pool.go
index 5e5958d..273e94c 100644
--- a/internal/binres/pool.go
+++ b/internal/binres/pool.go
@@ -25,28 +25,31 @@
// Pool is a container for string and style span collections.
//
// Pool has the following structure marshalled:
-// chunkHeader
-// uint32 number of strings in this pool
-// uint32 number of style spans in pool
-// uint32 SortedFlag, UTF8Flag
-// uint32 index of string data from header
-// uint32 index of style data from header
-// []uint32 string indices starting at zero
-// []uint16 or []uint8 concatenation of string entries
+//
+// chunkHeader
+// uint32 number of strings in this pool
+// uint32 number of style spans in pool
+// uint32 SortedFlag, UTF8Flag
+// uint32 index of string data from header
+// uint32 index of style data from header
+// []uint32 string indices starting at zero
+// []uint16 or []uint8 concatenation of string entries
//
// UTF-16 entries are as follows:
-// uint16 string length, exclusive
-// uint16 [optional] low word if high bit of length set
-// [n]byte data
-// uint16 0x0000 terminator
+//
+// uint16 string length, exclusive
+// uint16 [optional] low word if high bit of length set
+// [n]byte data
+// uint16 0x0000 terminator
//
// UTF-8 entries are as follows:
-// uint8 character length, exclusive
-// uint8 [optional] low word if high bit of character length set
-// uint8 byte length, exclusive
-// uint8 [optional] low word if high bit of byte length set
-// [n]byte data
-// uint8 0x00 terminator
+//
+// uint8 character length, exclusive
+// uint8 [optional] low word if high bit of character length set
+// uint8 byte length, exclusive
+// uint8 [optional] low word if high bit of byte length set
+// [n]byte data
+// uint8 0x00 terminator
type Pool struct {
chunkHeader
strings []string
diff --git a/internal/binres/table.go b/internal/binres/table.go
index 6c80aff..304736d 100644
--- a/internal/binres/table.go
+++ b/internal/binres/table.go
@@ -22,10 +22,11 @@
// Resolve returns the Entry of TableRef in the given table.
//
// A TableRef is structured as follows:
-// 0xpptteeee
-// pp: package index
-// tt: type spec index in package
-// eeee: entry index in type spec
+//
+// 0xpptteeee
+// pp: package index
+// tt: type spec index in package
+// eeee: entry index in type spec
//
// The package and type spec values start at 1 for the first item,
// to help catch cases where they have not been supplied.
@@ -127,8 +128,10 @@
// indices.
//
// For example:
-// tbl.SpecByName("@android:style/Theme.NoTitleBar")
-// tbl.SpecByName("style")
+//
+// tbl.SpecByName("@android:style/Theme.NoTitleBar")
+// tbl.SpecByName("style")
+//
// Both locate the spec by name "style".
func (tbl *Table) SpecByName(name string) (int, *Package, int, *TypeSpec, error) {
n := strings.TrimPrefix(name, "@android:")
diff --git a/internal/importers/ast.go b/internal/importers/ast.go
index b9e36ee..64da4a1 100644
--- a/internal/importers/ast.go
+++ b/internal/importers/ast.go
@@ -7,15 +7,17 @@
// It is used by the language specific importers to determine the set of
// wrapper types to be generated.
//
-// For example, in the Go file
+// # For example, in the Go file
//
// package javaprogram
//
// import "Java/java/lang"
//
// func F() {
-// o := lang.Object.New()
-// ...
+//
+// o := lang.Object.New()
+// ...
+//
// }
//
// the java importer uses this package to determine that the "java/lang"
@@ -39,7 +41,7 @@
// References is the result of analyzing a Go file or set of Go packages.
//
-// For example, the Go file
+// # For example, the Go file
//
// package pkg
//
@@ -124,7 +126,9 @@
// import "Prefix/some/Package"
//
// type T struct {
-// Package.Class
+//
+// Package.Class
+//
// }
func (v *refsSaver) findEmbeddingStructs(pkgpath string, pkg *ast.Package) {
var names []string
diff --git a/internal/importers/java/java.go b/internal/importers/java/java.go
index 3a26dfb..5a813a1 100644
--- a/internal/importers/java/java.go
+++ b/internal/importers/java/java.go
@@ -178,16 +178,17 @@
//
// Compiled from "System.java"
// public final class java.lang.System {
-// public static final java.io.InputStream in;
-// descriptor: Ljava/io/InputStream;
-// public static final java.io.PrintStream out;
-// descriptor: Ljava/io/PrintStream;
-// public static final java.io.PrintStream err;
-// descriptor: Ljava/io/PrintStream;
-// public static void setIn(java.io.InputStream);
-// descriptor: (Ljava/io/InputStream;)V
//
-// ...
+// public static final java.io.InputStream in;
+// descriptor: Ljava/io/InputStream;
+// public static final java.io.PrintStream out;
+// descriptor: Ljava/io/PrintStream;
+// public static final java.io.PrintStream err;
+// descriptor: Ljava/io/PrintStream;
+// public static void setIn(java.io.InputStream);
+// descriptor: (Ljava/io/InputStream;)V
+//
+// ...
//
// }
func (j *Importer) Import(refs *importers.References) ([]*Class, error) {
@@ -409,27 +410,27 @@
//
// For example, the class
//
-// class A {
-// void f();
-// }
+// class A {
+// void f();
+// }
//
// is by itself represented by the Go interface
//
-// type A interface {
-// f()
-// }
+// type A interface {
+// f()
+// }
//
// However, if class
//
-// class B extends A {
-// void f(int);
-// }
+// class B extends A {
+// void f(int);
+// }
//
// is also imported, it will be represented as
//
-// type B interface {
-// f(...int32)
-// }
+// type B interface {
+// f(...int32)
+// }
//
// To make Go B assignable to Go A, the signature of A's f must
// be updated to f(...int32) as well.
To view, visit change 399597. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot submitted this change.
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: apidiff/testdata/tests.go
Insertions: 18, Deletions: 19.
@@ -1,8 +1,7 @@
// This file is split into two packages, old and new.
// It is syntactically valid Go so that gofmt can process it.
//
-// If a comment begins with: Then:
-//
+// If a comment begins with: Then:
// old write subsequent lines to the "old" package
// new write subsequent lines to the "new" package
// both write subsequent lines to both packages
@@ -15,11 +14,11 @@
//////////////// Basics
-// // Same type in both: OK.
+// Same type in both: OK.
// both
type A int
-// // Changing the type is an incompatible change.
+// Changing the type is an incompatible change.
// old
type B int
@@ -27,7 +26,7 @@
// i B: changed from int to string
type B string
-// // Adding a new type, whether alias or not, is a compatible change.
+// Adding a new type, whether alias or not, is a compatible change.
// new
// c AA: added
type AA = A
@@ -35,14 +34,14 @@
// c B1: added
type B1 bool
-// // Change of type for an unexported name doesn't matter...
+// Change of type for an unexported name doesn't matter...
// old
type t int
// new
type t string // OK: t isn't part of the API
-// // ...unless it is exposed.
+// ...unless it is exposed.
// both
var V2 u
@@ -53,7 +52,7 @@
// i u: changed from string to int
type u int
-// // An exposed, unexported type can be renamed.
+// An exposed, unexported type can be renamed.
// both
type u2 int
@@ -65,7 +64,7 @@
// new
var V5 u2 // OK: V5 has changed type, but old u1 corresopnds to new u2
-// // Splitting a single type into two is an incompatible change.
+// Splitting a single type into two is an incompatible change.
// both
type u3 int
@@ -84,7 +83,7 @@
Split2 = u3
)
-// // Merging two types into one is OK.
+// Merging two types into one is OK.
// old
type (
GoodMerge1 = u2
@@ -97,7 +96,7 @@
GoodMerge2 = u3
)
-// // Merging isn't OK here because a method is lost.
+// Merging isn't OK here because a method is lost.
// both
type u4 int
@@ -126,7 +125,7 @@
//////////////// Constants
-// // type changes
+// type changes
// old
const (
C1 = 1
@@ -173,7 +172,7 @@
//////////////// Variables
-// // simple type changes
+// simple type changes
// old
var (
V1 string
@@ -190,7 +189,7 @@
V7 chan int
)
-// // interface type changes
+// interface type changes
// old
var (
V9 interface{ M() }
@@ -211,7 +210,7 @@
V11 interface{ M(int) }
)
-// // struct type changes
+// struct type changes
// old
var (
VS1 struct{ A, B int }
@@ -631,7 +630,7 @@
*S4 // OK: same (recursive embedding)
}
-// // Difference between exported selectable fields and exported immediate fields.
+// Difference between exported selectable fields and exported immediate fields.
// both
type S5 struct{ A int }
@@ -652,7 +651,7 @@
S5
}
-// // Ambiguous fields can exist; they just can't be selected.
+// Ambiguous fields can exist; they just can't be selected.
// both
type (
embed7a struct{ E int }
@@ -874,7 +873,7 @@
//// Splitting types
-// // OK: in both old and new, {J1, K1, L1} name the same type.
+// OK: in both old and new, {J1, K1, L1} name the same type.
// old
type (
J1 = K1
@@ -889,7 +888,7 @@
L1 = J1
)
-// // Old has one type, K2; new has J2 and K2.
+// Old has one type, K2; new has J2 and K2.
// both
type K2 int
```
```
The name of the file: apidiff/compatibility.go
Insertions: 7, Deletions: 9.
@@ -134,18 +134,16 @@
}
// We need to check three things for structs:
-// 1. The set of exported fields must be compatible. This ensures that keyed struct
//
-// literals continue to compile. (There is no compatibility guarantee for unkeyed
-// struct literals.)
+// 1. The set of exported fields must be compatible. This ensures that keyed struct
+// literals continue to compile. (There is no compatibility guarantee for unkeyed
+// struct literals.)
//
-// 2. The set of exported *selectable* fields must be compatible. This includes the exported
+// 2. The set of exported *selectable* fields must be compatible. This includes the exported
+// fields of all embedded structs. This ensures that selections continue to compile.
//
-// fields of all embedded structs. This ensures that selections continue to compile.
-//
-// 3. If the old struct is comparable, so must the new one be. This ensures that equality
-//
-// expressions and uses of struct values as map keys continue to compile.
+// 3. If the old struct is comparable, so must the new one be. This ensures that equality
+// expressions and uses of struct values as map keys continue to compile.
//
// An unexported embedded struct can't appear in a struct literal outside the
// package, so it doesn't have to be present, or have the same name, in the new
```
```
The name of the file: cmd/macos-roots-test/root_darwin.go
Insertions: 5, Deletions: 7.
@@ -29,14 +29,12 @@
//
// The strategy is as follows:
//
-// 1. Run "security find-certificate" to dump the list of system root
+// 1. Run "security find-certificate" to dump the list of system root
+// CAs in PEM format.
//
-// CAs in PEM format.
-//
-// 2. For each dumped cert, conditionally verify it with "security
-//
-// verify-cert" if that cert was not in the SystemRootCertificates
-// keychain, which can't have custom trust policies.
+// 2. For each dumped cert, conditionally verify it with "security
+// verify-cert" if that cert was not in the SystemRootCertificates
+// keychain, which can't have custom trust policies.
//
// We need to run "verify-cert" for all certificates not in SystemRootCertificates
// because there might be certificates in the keychains without a corresponding
```
all: gofmt
Gofmt to update doc comments to the new formatting.
For golang/go#51082.
Change-Id: Iac828c845b6d7ae0eab93fcf007f3ef8e16c8ed7
Reviewed-on: https://go-review.googlesource.com/c/exp/+/399614
Run-TryBot: Russ Cox <r...@golang.org>
Reviewed-by: Ian Lance Taylor <ia...@google.com>
TryBot-Result: Gopher Robot <go...@golang.org>
Auto-Submit: Russ Cox <r...@golang.org>
---
M apidiff/compatibility.go
M apidiff/testdata/exported_fields/ef.go
M apidiff/testdata/tests.go
M cmd/gorelease/gorelease.go
M cmd/macos-roots-test/root_darwin.go
M cmd/txtar/txtar.go
M ebnf/ebnf.go
M ebnf/parser.go
M ebnflint/doc.go
M errors/errors.go
M errors/fmt/doc.go
M errors/fmt/print.go
M event/adapter/gokit/gokit_test.go
M event/adapter/logfmt/logfmt.go
M event/adapter/logr/logr_test.go
M event/adapter/logrus/logrus.go
M event/adapter/logrus/logrus_test.go
M event/adapter/zap/zap.go
M event/adapter/zap/zap_test.go
M event/alloc_test.go
M event/disabled.go
M event/export.go
M event/severity/severity_test.go
M event/source.go
M io/i2c/i2c.go
M io/spi/spi.go
M jsonrpc2/internal/stack/process.go
M jsonrpc2/internal/stack/stacktest/stacktest.go
M rand/exp.go
M rand/normal.go
M rand/rand.go
M rand/rng.go
M shiny/driver/gldriver/cocoa.go
M shiny/example/basic/main.go
M shiny/example/basicgl/main.go
M shiny/example/fluid/main.go
M shiny/example/goban/asset/resize.go
M shiny/example/goban/board.go
M shiny/example/goban/main.go
M shiny/example/goban/xy.go
M shiny/example/goban/xy_test.go
M shiny/example/icongallery/main.go
M shiny/example/imageview/main.go
M shiny/example/layout/main.go
M shiny/example/textedit/main.go
M shiny/example/tile/main.go
M shiny/example/widgetgallery/main.go
M shiny/iconvg/upgrade.go
M shiny/materialdesign/icons/gen.go
M shiny/text/caret.go
M shootout/binary-tree-freelist.go
M shootout/binary-tree.go
M shootout/chameneosredux.go
M shootout/fannkuch-parallel.go
M shootout/fannkuch.go
M shootout/fasta.go
M shootout/k-nucleotide-parallel.go
M shootout/k-nucleotide.go
M shootout/mandelbrot.go
M shootout/meteor-contest.go
M shootout/nbody.go
M shootout/pidigits.go
M shootout/regex-dna-parallel.go
M shootout/regex-dna.go
M shootout/reverse-complement.go
M shootout/spectral-norm-parallel.go
M shootout/spectral-norm.go
M shootout/threadring.go
M sumdb/gosumcheck/main.go
M sumdb/internal/note/note.go
M sumdb/internal/sumweb/server.go
M sumdb/internal/tlog/tlog.go
M typeparams/common.go
M typeparams/example/findtypeparams/main.go
M typeparams/example/genericmethods/main.go
M typeparams/example/implicit/main.go
M typeparams/example/instantiation/main.go
M typeparams/example/interfaces/main.go
M typeparams/example/methoddecls/main.go
M typeparams/example/predicates/main.go
M typeparams/example/typesets/main.go
M typeparams/normalize.go
M typeparams/typeterm.go
M winfsnotify/winfsnotify.go
M winfsnotify/winfsnotify_test.go
85 files changed, 543 insertions(+), 425 deletions(-)
diff --git a/apidiff/compatibility.go b/apidiff/compatibility.go
index f78da8f..44238fb 100644
--- a/apidiff/compatibility.go
+++ b/apidiff/compatibility.go
@@ -134,13 +134,16 @@
}
// We need to check three things for structs:
-// 1. The set of exported fields must be compatible. This ensures that keyed struct
-// literals continue to compile. (There is no compatibility guarantee for unkeyed
-// struct literals.)
-// 2. The set of exported *selectable* fields must be compatible. This includes the exported
-// fields of all embedded structs. This ensures that selections continue to compile.
-// 3. If the old struct is comparable, so must the new one be. This ensures that equality
-// expressions and uses of struct values as map keys continue to compile.
+//
+// 1. The set of exported fields must be compatible. This ensures that keyed struct
+// literals continue to compile. (There is no compatibility guarantee for unkeyed
+// struct literals.)
+//
+// 2. The set of exported *selectable* fields must be compatible. This includes the exported
+// fields of all embedded structs. This ensures that selections continue to compile.
+//
+// 3. If the old struct is comparable, so must the new one be. This ensures that equality
+// expressions and uses of struct values as map keys continue to compile.
//
// An unexported embedded struct can't appear in a struct literal outside the
// package, so it doesn't have to be present, or have the same name, in the new
diff --git a/apidiff/testdata/exported_fields/ef.go b/apidiff/testdata/exported_fields/ef.go
index 19da716..8e441e2 100644
--- a/apidiff/testdata/exported_fields/ef.go
+++ b/apidiff/testdata/exported_fields/ef.go
@@ -2,11 +2,12 @@
// Used for testing exportedFields.
// Its exported fields are:
-// A1 [1]int
-// D bool
-// E int
-// F F
-// S *S
+//
+// A1 [1]int
+// D bool
+// E int
+// F F
+// S *S
type (
S struct {
int
diff --git a/apidiff/testdata/tests.go b/apidiff/testdata/tests.go
index 014e813..61e9026 100644
--- a/apidiff/testdata/tests.go
+++ b/apidiff/testdata/tests.go
@@ -1,12 +1,12 @@
// This file is split into two packages, old and new.
// It is syntactically valid Go so that gofmt can process it.
//
-// If a comment begins with: Then:
-// old write subsequent lines to the "old" package
-// new write subsequent lines to the "new" package
-// both write subsequent lines to both packages
-// c expect a compatible error with the following text
-// i expect an incompatible error with the following text
+// If a comment begins with: Then:
+// old write subsequent lines to the "old" package
+// new write subsequent lines to the "new" package
+// both write subsequent lines to both packages
+// c expect a compatible error with the following text
+// i expect an incompatible error with the following text
package ignore
// both
@@ -14,11 +14,11 @@
//////////////// Basics
-//// Same type in both: OK.
+// Same type in both: OK.
// both
type A int
-//// Changing the type is an incompatible change.
+// Changing the type is an incompatible change.
// old
type B int
@@ -26,7 +26,7 @@
// i B: changed from int to string
type B string
-//// Adding a new type, whether alias or not, is a compatible change.
+// Adding a new type, whether alias or not, is a compatible change.
// new
// c AA: added
type AA = A
@@ -34,14 +34,14 @@
// c B1: added
type B1 bool
-//// Change of type for an unexported name doesn't matter...
+// Change of type for an unexported name doesn't matter...
// old
type t int
// new
type t string // OK: t isn't part of the API
-//// ...unless it is exposed.
+// ...unless it is exposed.
// both
var V2 u
@@ -52,7 +52,7 @@
// i u: changed from string to int
type u int
-//// An exposed, unexported type can be renamed.
+// An exposed, unexported type can be renamed.
// both
type u2 int
@@ -64,7 +64,7 @@
// new
var V5 u2 // OK: V5 has changed type, but old u1 corresopnds to new u2
-//// Splitting a single type into two is an incompatible change.
+// Splitting a single type into two is an incompatible change.
// both
type u3 int
@@ -83,7 +83,7 @@
Split2 = u3
)
-//// Merging two types into one is OK.
+// Merging two types into one is OK.
// old
type (
GoodMerge1 = u2
@@ -96,7 +96,7 @@
GoodMerge2 = u3
)
-//// Merging isn't OK here because a method is lost.
+// Merging isn't OK here because a method is lost.
// both
type u4 int
@@ -125,7 +125,7 @@
//////////////// Constants
-//// type changes
+// type changes
// old
const (
C1 = 1
@@ -172,7 +172,7 @@
//////////////// Variables
-//// simple type changes
+// simple type changes
// old
var (
V1 string
@@ -189,7 +189,7 @@
V7 chan int
)
-//// interface type changes
+// interface type changes
// old
var (
V9 interface{ M() }
@@ -210,7 +210,7 @@
V11 interface{ M(int) }
)
-//// struct type changes
+// struct type changes
// old
var (
VS1 struct{ A, B int }
@@ -413,7 +413,8 @@
// i I5: changed from io.Writer to I5
// In old, I5 and io.Writer are the same type; in new,
// they are different. That can break something like:
-// var _ func(io.Writer) = func(pkg.I6) {}
+//
+// var _ func(io.Writer) = func(pkg.I6) {}
type I5 io.Writer
// old
@@ -471,7 +472,9 @@
// i VT4: changed from int to t4
// This is incompatible because of code like
-// VT4 + int(1)
+//
+// VT4 + int(1)
+//
// which works in old but fails in new.
// The difference from the above cases is that
// in those, we were merging two types into one;
@@ -627,7 +630,7 @@
*S4 // OK: same (recursive embedding)
}
-//// Difference between exported selectable fields and exported immediate fields.
+// Difference between exported selectable fields and exported immediate fields.
// both
type S5 struct{ A int }
@@ -648,7 +651,7 @@
S5
}
-//// Ambiguous fields can exist; they just can't be selected.
+// Ambiguous fields can exist; they just can't be selected.
// both
type (
embed7a struct{ E int }
@@ -870,7 +873,7 @@
//// Splitting types
-//// OK: in both old and new, {J1, K1, L1} name the same type.
+// OK: in both old and new, {J1, K1, L1} name the same type.
// old
type (
J1 = K1
@@ -885,7 +888,7 @@
L1 = J1
)
-//// Old has one type, K2; new has J2 and K2.
+// Old has one type, K2; new has J2 and K2.
// both
type K2 int
diff --git a/cmd/gorelease/gorelease.go b/cmd/gorelease/gorelease.go
index 340d81f..b0ee1e9 100644
--- a/cmd/gorelease/gorelease.go
+++ b/cmd/gorelease/gorelease.go
@@ -7,21 +7,21 @@
//
// Usage:
//
-// gorelease [-base={version|none}] [-version=version]
+// gorelease [-base={version|none}] [-version=version]
//
// Examples:
//
-// # Compare with the latest version and suggest a new version.
-// gorelease
+// # Compare with the latest version and suggest a new version.
+// gorelease
//
-// # Compare with a specific version and suggest a new version.
-// gorelease -base=v1.2.3
+// # Compare with a specific version and suggest a new version.
+// gorelease -base=v1.2.3
//
-// # Compare with the latest version and check a specific new version for compatibility.
-// gorelease -version=v1.3.0
+// # Compare with the latest version and check a specific new version for compatibility.
+// gorelease -version=v1.3.0
//
-// # Compare with a specific version and check a specific new version for compatibility.
-// gorelease -base=v1.2.3 -version=v1.3.0
+// # Compare with a specific version and check a specific new version for compatibility.
+// gorelease -base=v1.2.3 -version=v1.3.0
//
// gorelease analyzes changes in the public API and dependencies of the main
// module. It compares a base version (set with -base) with the currently
diff --git a/cmd/macos-roots-test/root_darwin.go b/cmd/macos-roots-test/root_darwin.go
index 25cbcd1..b5bf0f7 100644
--- a/cmd/macos-roots-test/root_darwin.go
+++ b/cmd/macos-roots-test/root_darwin.go
@@ -29,12 +29,12 @@
//
// The strategy is as follows:
//
-// 1. Run "security find-certificate" to dump the list of system root
-// CAs in PEM format.
+// 1. Run "security find-certificate" to dump the list of system root
+// CAs in PEM format.
//
-// 2. For each dumped cert, conditionally verify it with "security
-// verify-cert" if that cert was not in the SystemRootCertificates
-// keychain, which can't have custom trust policies.
+// 2. For each dumped cert, conditionally verify it with "security
+// verify-cert" if that cert was not in the SystemRootCertificates
+// keychain, which can't have custom trust policies.
//
// We need to run "verify-cert" for all certificates not in SystemRootCertificates
// because there might be certificates in the keychains without a corresponding
diff --git a/cmd/txtar/txtar.go b/cmd/txtar/txtar.go
index 072f416..9beb163 100644
--- a/cmd/txtar/txtar.go
+++ b/cmd/txtar/txtar.go
@@ -25,10 +25,9 @@
//
// Example usage:
//
-// txtar *.go <README >testdata/example.txt
+// txtar *.go <README >testdata/example.txt
//
-// txtar --extract <playground_example.txt >main.go
-//
+// txtar --extract <playground_example.txt >main.go
package main
import (
diff --git a/ebnf/ebnf.go b/ebnf/ebnf.go
index ef1f946..a4e20f0 100644
--- a/ebnf/ebnf.go
+++ b/ebnf/ebnf.go
@@ -19,7 +19,6 @@
// non-terminal productions (i.e., productions which allow white-space
// and comments between tokens); all other production names denote
// lexical productions.
-//
package ebnf // import "golang.org/x/exp/ebnf"
import (
@@ -256,12 +255,11 @@
}
// Verify checks that:
-// - all productions used are defined
-// - all productions defined are used when beginning at start
-// - lexical productions refer only to other lexical productions
+// - all productions used are defined
+// - all productions defined are used when beginning at start
+// - lexical productions refer only to other lexical productions
//
// Position information is interpreted relative to the file set fset.
-//
func Verify(grammar Grammar, start string) error {
var v verifier
v.verify(grammar, start)
diff --git a/ebnf/parser.go b/ebnf/parser.go
index fd676bc..7aa7a70 100644
--- a/ebnf/parser.go
+++ b/ebnf/parser.go
@@ -182,7 +182,6 @@
// for incorrect syntax and if a production is declared
// more than once; the filename is used only for error
// positions.
-//
func Parse(filename string, src io.Reader) (Grammar, error) {
var p parser
grammar := p.parse(filename, src)
diff --git a/ebnflint/doc.go b/ebnflint/doc.go
index 3080b58..79d3a66 100644
--- a/ebnflint/doc.go
+++ b/ebnflint/doc.go
@@ -3,20 +3,19 @@
// license that can be found in the LICENSE file.
/*
-
Ebnflint verifies that EBNF productions are consistent and grammatically correct.
It reads them from an HTML document such as the Go specification.
Grammar productions are grouped in boxes demarcated by the HTML elements
+
<pre class="ebnf">
</pre>
-
Usage:
+
go tool ebnflint [--start production] [file]
The --start flag specifies the name of the start production for
the grammar; it defaults to "Start".
-
*/
package main // import "golang.org/x/exp/ebnflint"
diff --git a/errors/errors.go b/errors/errors.go
index 39d7c5e..bcd705d 100644
--- a/errors/errors.go
+++ b/errors/errors.go
@@ -5,7 +5,8 @@
// Package errors implements functions to manipulate errors.
//
// This package implements the Go 2 draft designs for error inspection and printing:
-// https://go.googlesource.com/proposal/+/master/design/go2draft.md
+//
+// https://go.googlesource.com/proposal/+/master/design/go2draft.md
//
// This is an EXPERIMENTAL package, and may change in arbitrary ways without notice.
package errors
diff --git a/errors/fmt/doc.go b/errors/fmt/doc.go
index 72aee6b..56bd157 100644
--- a/errors/fmt/doc.go
+++ b/errors/fmt/doc.go
@@ -3,344 +3,378 @@
// license that can be found in the LICENSE file.
/*
- Package fmt implements formatted I/O with functions analogous
- to C's printf and scanf. The format 'verbs' are derived from C's but
- are simpler.
+Package fmt implements formatted I/O with functions analogous
+to C's printf and scanf. The format 'verbs' are derived from C's but
+are simpler.
+# Printing
- Printing
+The verbs:
- The verbs:
+General:
- General:
- %v the value in a default format
- when printing structs, the plus flag (%+v) adds field names
- %#v a Go-syntax representation of the value
- %T a Go-syntax representation of the type of the value
- %% a literal percent sign; consumes no value
+ %v the value in a default format
+ when printing structs, the plus flag (%+v) adds field names
+ %#v a Go-syntax representation of the value
+ %T a Go-syntax representation of the type of the value
+ %% a literal percent sign; consumes no value
- Boolean:
- %t the word true or false
- Integer:
- %b base 2
- %c the character represented by the corresponding Unicode code point
- %d base 10
- %o base 8
- %q a single-quoted character literal safely escaped with Go syntax.
- %x base 16, with lower-case letters for a-f
- %X base 16, with upper-case letters for A-F
- %U Unicode format: U+1234; same as "U+%04X"
- Floating-point and complex constituents:
- %b decimalless scientific notation with exponent a power of two,
- in the manner of strconv.FormatFloat with the 'b' format,
- e.g. -123456p-78
- %e scientific notation, e.g. -1.234456e+78
- %E scientific notation, e.g. -1.234456E+78
- %f decimal point but no exponent, e.g. 123.456
- %F synonym for %f
- %g %e for large exponents, %f otherwise. Precision is discussed below.
- %G %E for large exponents, %F otherwise
- String and slice of bytes (treated equivalently with these verbs):
- %s the uninterpreted bytes of the string or slice
- %q a double-quoted string safely escaped with Go syntax
- %x base 16, lower-case, two characters per byte
- %X base 16, upper-case, two characters per byte
- Slice:
- %p address of 0th element in base 16 notation, with leading 0x
- Pointer:
- %p base 16 notation, with leading 0x
- The %b, %d, %o, %x and %X verbs also work with pointers,
- formatting the value exactly as if it were an integer.
+Boolean:
- The default format for %v is:
- bool: %t
- int, int8 etc.: %d
- uint, uint8 etc.: %d, %#x if printed with %#v
- float32, complex64, etc: %g
- string: %s
- chan: %p
- pointer: %p
- For compound objects, the elements are printed using these rules, recursively,
- laid out like this:
- struct: {field0 field1 ...}
- array, slice: [elem0 elem1 ...]
- maps: map[key1:value1 key2:value2 ...]
- pointer to above: &{}, &[], &map[]
+ %t the word true or false
- Width is specified by an optional decimal number immediately preceding the verb.
- If absent, the width is whatever is necessary to represent the value.
- Precision is specified after the (optional) width by a period followed by a
- decimal number. If no period is present, a default precision is used.
- A period with no following number specifies a precision of zero.
- Examples:
- %f default width, default precision
- %9f width 9, default precision
- %.2f default width, precision 2
- %9.2f width 9, precision 2
- %9.f width 9, precision 0
+Integer:
- Width and precision are measured in units of Unicode code points,
- that is, runes. (This differs from C's printf where the
- units are always measured in bytes.) Either or both of the flags
- may be replaced with the character '*', causing their values to be
- obtained from the next operand (preceding the one to format),
- which must be of type int.
+ %b base 2
+ %c the character represented by the corresponding Unicode code point
+ %d base 10
+ %o base 8
+ %q a single-quoted character literal safely escaped with Go syntax.
+ %x base 16, with lower-case letters for a-f
+ %X base 16, with upper-case letters for A-F
+ %U Unicode format: U+1234; same as "U+%04X"
- For most values, width is the minimum number of runes to output,
- padding the formatted form with spaces if necessary.
+Floating-point and complex constituents:
- For strings, byte slices and byte arrays, however, precision
- limits the length of the input to be formatted (not the size of
- the output), truncating if necessary. Normally it is measured in
- runes, but for these types when formatted with the %x or %X format
- it is measured in bytes.
+ %b decimalless scientific notation with exponent a power of two,
+ in the manner of strconv.FormatFloat with the 'b' format,
+ e.g. -123456p-78
+ %e scientific notation, e.g. -1.234456e+78
+ %E scientific notation, e.g. -1.234456E+78
+ %f decimal point but no exponent, e.g. 123.456
+ %F synonym for %f
+ %g %e for large exponents, %f otherwise. Precision is discussed below.
+ %G %E for large exponents, %F otherwise
- For floating-point values, width sets the minimum width of the field and
- precision sets the number of places after the decimal, if appropriate,
- except that for %g/%G precision sets the maximum number of significant
- digits (trailing zeros are removed). For example, given 12.345 the format
- %6.3f prints 12.345 while %.3g prints 12.3. The default precision for %e, %f
- and %#g is 6; for %g it is the smallest number of digits necessary to identify
- the value uniquely.
+String and slice of bytes (treated equivalently with these verbs):
- For complex numbers, the width and precision apply to the two
- components independently and the result is parenthesized, so %f applied
- to 1.2+3.4i produces (1.200000+3.400000i).
+ %s the uninterpreted bytes of the string or slice
+ %q a double-quoted string safely escaped with Go syntax
+ %x base 16, lower-case, two characters per byte
+ %X base 16, upper-case, two characters per byte
- Other flags:
- + always print a sign for numeric values;
- guarantee ASCII-only output for %q (%+q)
- - pad with spaces on the right rather than the left (left-justify the field)
- # alternate format: add leading 0 for octal (%#o), 0x for hex (%#x);
- 0X for hex (%#X); suppress 0x for %p (%#p);
- for %q, print a raw (backquoted) string if strconv.CanBackquote
- returns true;
- always print a decimal point for %e, %E, %f, %F, %g and %G;
- do not remove trailing zeros for %g and %G;
- write e.g. U+0078 'x' if the character is printable for %U (%#U).
- ' ' (space) leave a space for elided sign in numbers (% d);
- put spaces between bytes printing strings or slices in hex (% x, % X)
- 0 pad with leading zeros rather than spaces;
- for numbers, this moves the padding after the sign
+Slice:
- Flags are ignored by verbs that do not expect them.
- For example there is no alternate decimal format, so %#d and %d
- behave identically.
+ %p address of 0th element in base 16 notation, with leading 0x
- For each Printf-like function, there is also a Print function
- that takes no format and is equivalent to saying %v for every
- operand. Another variant Println inserts blanks between
- operands and appends a newline.
+Pointer:
- Regardless of the verb, if an operand is an interface value,
- the internal concrete value is used, not the interface itself.
- Thus:
- var i interface{} = 23
- fmt.Printf("%v\n", i)
- will print 23.
+ %p base 16 notation, with leading 0x
+ The %b, %d, %o, %x and %X verbs also work with pointers,
+ formatting the value exactly as if it were an integer.
- Except when printed using the verbs %T and %p, special
- formatting considerations apply for operands that implement
- certain interfaces. In order of application:
+The default format for %v is:
- 1. If the operand is a reflect.Value, the operand is replaced by the
- concrete value that it holds, and printing continues with the next rule.
+ bool: %t
+ int, int8 etc.: %d
+ uint, uint8 etc.: %d, %#x if printed with %#v
+ float32, complex64, etc: %g
+ string: %s
+ chan: %p
+ pointer: %p
- 2. If an operand implements the Formatter interface, and not
- errors.Formatter, it will be invoked. Formatter provides fine
- control of formatting.
+For compound objects, the elements are printed using these rules, recursively,
+laid out like this:
- 3. If the %v verb is used with the # flag (%#v) and the operand
- implements the GoStringer interface, that will be invoked.
+ struct: {field0 field1 ...}
+ array, slice: [elem0 elem1 ...]
+ maps: map[key1:value1 key2:value2 ...]
+ pointer to above: &{}, &[], &map[]
- If the format (which is implicitly %v for Println etc.) is valid
- for a string (%s %q %v %x %X), the following three rules apply:
+Width is specified by an optional decimal number immediately preceding the verb.
+If absent, the width is whatever is necessary to represent the value.
+Precision is specified after the (optional) width by a period followed by a
+decimal number. If no period is present, a default precision is used.
+A period with no following number specifies a precision of zero.
+Examples:
- 4. If an operand implements errors.Formatter, the FormatError
- method will be invoked with an errors.Printer to print the error.
- If the %v flag is used with the + flag (%+v), the Detail method
- of the Printer will return true and the error will be formatted
- as a detailed error message. Otherwise the printed string will
- be formatted as required by the verb (if any).
+ %f default width, default precision
+ %9f width 9, default precision
+ %.2f default width, precision 2
+ %9.2f width 9, precision 2
+ %9.f width 9, precision 0
- 5. If an operand implements the error interface, the Error method
- will be invoked to convert the object to a string, which will then
- be formatted as required by the verb (if any).
+Width and precision are measured in units of Unicode code points,
+that is, runes. (This differs from C's printf where the
+units are always measured in bytes.) Either or both of the flags
+may be replaced with the character '*', causing their values to be
+obtained from the next operand (preceding the one to format),
+which must be of type int.
- 6. If an operand implements method String() string, that method
- will be invoked to convert the object to a string, which will then
- be formatted as required by the verb (if any).
+For most values, width is the minimum number of runes to output,
+padding the formatted form with spaces if necessary.
- For compound operands such as slices and structs, the format
- applies to the elements of each operand, recursively, not to the
- operand as a whole. Thus %q will quote each element of a slice
- of strings, and %6.2f will control formatting for each element
- of a floating-point array.
+For strings, byte slices and byte arrays, however, precision
+limits the length of the input to be formatted (not the size of
+the output), truncating if necessary. Normally it is measured in
+runes, but for these types when formatted with the %x or %X format
+it is measured in bytes.
- However, when printing a byte slice with a string-like verb
- (%s %q %x %X), it is treated identically to a string, as a single item.
+For floating-point values, width sets the minimum width of the field and
+precision sets the number of places after the decimal, if appropriate,
+except that for %g/%G precision sets the maximum number of significant
+digits (trailing zeros are removed). For example, given 12.345 the format
+%6.3f prints 12.345 while %.3g prints 12.3. The default precision for %e, %f
+and %#g is 6; for %g it is the smallest number of digits necessary to identify
+the value uniquely.
- To avoid recursion in cases such as
- type X string
- func (x X) String() string { return Sprintf("<%s>", x) }
- convert the value before recurring:
- func (x X) String() string { return Sprintf("<%s>", string(x)) }
- Infinite recursion can also be triggered by self-referential data
- structures, such as a slice that contains itself as an element, if
- that type has a String method. Such pathologies are rare, however,
- and the package does not protect against them.
+For complex numbers, the width and precision apply to the two
+components independently and the result is parenthesized, so %f applied
+to 1.2+3.4i produces (1.200000+3.400000i).
- When printing a struct, fmt cannot and therefore does not invoke
- formatting methods such as Error or String on unexported fields.
+Other flags:
+ - always print a sign for numeric values;
+ guarantee ASCII-only output for %q (%+q)
+ - pad with spaces on the right rather than the left (left-justify the field)
+ # alternate format: add leading 0 for octal (%#o), 0x for hex (%#x);
+ 0X for hex (%#X); suppress 0x for %p (%#p);
+ for %q, print a raw (backquoted) string if strconv.CanBackquote
+ returns true;
+ always print a decimal point for %e, %E, %f, %F, %g and %G;
+ do not remove trailing zeros for %g and %G;
+ write e.g. U+0078 'x' if the character is printable for %U (%#U).
+ ' ' (space) leave a space for elided sign in numbers (% d);
+ put spaces between bytes printing strings or slices in hex (% x, % X)
+ 0 pad with leading zeros rather than spaces;
+ for numbers, this moves the padding after the sign
- Explicit argument indexes:
+Flags are ignored by verbs that do not expect them.
+For example there is no alternate decimal format, so %#d and %d
+behave identically.
- In Printf, Sprintf, and Fprintf, the default behavior is for each
- formatting verb to format successive arguments passed in the call.
- However, the notation [n] immediately before the verb indicates that the
- nth one-indexed argument is to be formatted instead. The same notation
- before a '*' for a width or precision selects the argument index holding
- the value. After processing a bracketed expression [n], subsequent verbs
- will use arguments n+1, n+2, etc. unless otherwise directed.
+For each Printf-like function, there is also a Print function
+that takes no format and is equivalent to saying %v for every
+operand. Another variant Println inserts blanks between
+operands and appends a newline.
- For example,
- fmt.Sprintf("%[2]d %[1]d\n", 11, 22)
- will yield "22 11", while
- fmt.Sprintf("%[3]*.[2]*[1]f", 12.0, 2, 6)
- equivalent to
- fmt.Sprintf("%6.2f", 12.0)
- will yield " 12.00". Because an explicit index affects subsequent verbs,
- this notation can be used to print the same values multiple times
- by resetting the index for the first argument to be repeated:
- fmt.Sprintf("%d %d %#[1]x %#x", 16, 17)
- will yield "16 17 0x10 0x11".
+Regardless of the verb, if an operand is an interface value,
+the internal concrete value is used, not the interface itself.
+Thus:
- Format errors:
+ var i interface{} = 23
+ fmt.Printf("%v\n", i)
- If an invalid argument is given for a verb, such as providing
- a string to %d, the generated string will contain a
- description of the problem, as in these examples:
+will print 23.
- Wrong type or unknown verb: %!verb(type=value)
- Printf("%d", hi): %!d(string=hi)
- Too many arguments: %!(EXTRA type=value)
- Printf("hi", "guys"): hi%!(EXTRA string=guys)
- Too few arguments: %!verb(MISSING)
- Printf("hi%d"): hi%!d(MISSING)
- Non-int for width or precision: %!(BADWIDTH) or %!(BADPREC)
- Printf("%*s", 4.5, "hi"): %!(BADWIDTH)hi
- Printf("%.*s", 4.5, "hi"): %!(BADPREC)hi
- Invalid or invalid use of argument index: %!(BADINDEX)
- Printf("%*[2]d", 7): %!d(BADINDEX)
- Printf("%.[2]d", 7): %!d(BADINDEX)
+Except when printed using the verbs %T and %p, special
+formatting considerations apply for operands that implement
+certain interfaces. In order of application:
- All errors begin with the string "%!" followed sometimes
- by a single character (the verb) and end with a parenthesized
- description.
+1. If the operand is a reflect.Value, the operand is replaced by the
+concrete value that it holds, and printing continues with the next rule.
- If an Error or String method triggers a panic when called by a
- print routine, the fmt package reformats the error message
- from the panic, decorating it with an indication that it came
- through the fmt package. For example, if a String method
- calls panic("bad"), the resulting formatted message will look
- like
- %!s(PANIC=bad)
+2. If an operand implements the Formatter interface, and not
+errors.Formatter, it will be invoked. Formatter provides fine
+control of formatting.
- The %!s just shows the print verb in use when the failure
- occurred. If the panic is caused by a nil receiver to an Error
- or String method, however, the output is the undecorated
- string, "<nil>".
+3. If the %v verb is used with the # flag (%#v) and the operand
+implements the GoStringer interface, that will be invoked.
- Scanning
+If the format (which is implicitly %v for Println etc.) is valid
+for a string (%s %q %v %x %X), the following three rules apply:
- An analogous set of functions scans formatted text to yield
- values. Scan, Scanf and Scanln read from os.Stdin; Fscan,
- Fscanf and Fscanln read from a specified io.Reader; Sscan,
- Sscanf and Sscanln read from an argument string.
+4. If an operand implements errors.Formatter, the FormatError
+method will be invoked with an errors.Printer to print the error.
+If the %v flag is used with the + flag (%+v), the Detail method
+of the Printer will return true and the error will be formatted
+as a detailed error message. Otherwise the printed string will
+be formatted as required by the verb (if any).
- Scan, Fscan, Sscan treat newlines in the input as spaces.
+5. If an operand implements the error interface, the Error method
+will be invoked to convert the object to a string, which will then
+be formatted as required by the verb (if any).
- Scanln, Fscanln and Sscanln stop scanning at a newline and
- require that the items be followed by a newline or EOF.
+6. If an operand implements method String() string, that method
+will be invoked to convert the object to a string, which will then
+be formatted as required by the verb (if any).
- Scanf, Fscanf, and Sscanf parse the arguments according to a
- format string, analogous to that of Printf. In the text that
- follows, 'space' means any Unicode whitespace character
- except newline.
+For compound operands such as slices and structs, the format
+applies to the elements of each operand, recursively, not to the
+operand as a whole. Thus %q will quote each element of a slice
+of strings, and %6.2f will control formatting for each element
+of a floating-point array.
- In the format string, a verb introduced by the % character
- consumes and parses input; these verbs are described in more
- detail below. A character other than %, space, or newline in
- the format consumes exactly that input character, which must
- be present. A newline with zero or more spaces before it in
- the format string consumes zero or more spaces in the input
- followed by a single newline or the end of the input. A space
- following a newline in the format string consumes zero or more
- spaces in the input. Otherwise, any run of one or more spaces
- in the format string consumes as many spaces as possible in
- the input. Unless the run of spaces in the format string
- appears adjacent to a newline, the run must consume at least
- one space from the input or find the end of the input.
+However, when printing a byte slice with a string-like verb
+(%s %q %x %X), it is treated identically to a string, as a single item.
- The handling of spaces and newlines differs from that of C's
- scanf family: in C, newlines are treated as any other space,
- and it is never an error when a run of spaces in the format
- string finds no spaces to consume in the input.
+To avoid recursion in cases such as
- The verbs behave analogously to those of Printf.
- For example, %x will scan an integer as a hexadecimal number,
- and %v will scan the default representation format for the value.
- The Printf verbs %p and %T and the flags # and + are not implemented.
- The verbs %e %E %f %F %g and %G are all equivalent and scan any
- floating-point or complex value. For float and complex literals in
- scientific notation, both the decimal (e) and binary (p) exponent
- formats are supported (for example: "2.3e+7" and "4.5p-8").
+ type X string
+ func (x X) String() string { return Sprintf("<%s>", x) }
- Input processed by verbs is implicitly space-delimited: the
- implementation of every verb except %c starts by discarding
- leading spaces from the remaining input, and the %s verb
- (and %v reading into a string) stops consuming input at the first
- space or newline character.
+convert the value before recurring:
- The familiar base-setting prefixes 0 (octal) and 0x
- (hexadecimal) are accepted when scanning integers without
- a format or with the %v verb.
+ func (x X) String() string { return Sprintf("<%s>", string(x)) }
- Width is interpreted in the input text but there is no
- syntax for scanning with a precision (no %5.2f, just %5f).
- If width is provided, it applies after leading spaces are
- trimmed and specifies the maximum number of runes to read
- to satisfy the verb. For example,
- Sscanf(" 1234567 ", "%5s%d", &s, &i)
- will set s to "12345" and i to 67 while
- Sscanf(" 12 34 567 ", "%5s%d", &s, &i)
- will set s to "12" and i to 34.
+Infinite recursion can also be triggered by self-referential data
+structures, such as a slice that contains itself as an element, if
+that type has a String method. Such pathologies are rare, however,
+and the package does not protect against them.
- In all the scanning functions, a carriage return followed
- immediately by a newline is treated as a plain newline
- (\r\n means the same as \n).
+When printing a struct, fmt cannot and therefore does not invoke
+formatting methods such as Error or String on unexported fields.
- In all the scanning functions, if an operand implements method
- Scan (that is, it implements the Scanner interface) that
- method will be used to scan the text for that operand. Also,
- if the number of arguments scanned is less than the number of
- arguments provided, an error is returned.
+Explicit argument indexes:
- All arguments to be scanned must be either pointers to basic
- types or implementations of the Scanner interface.
+In Printf, Sprintf, and Fprintf, the default behavior is for each
+formatting verb to format successive arguments passed in the call.
+However, the notation [n] immediately before the verb indicates that the
+nth one-indexed argument is to be formatted instead. The same notation
+before a '*' for a width or precision selects the argument index holding
+the value. After processing a bracketed expression [n], subsequent verbs
+will use arguments n+1, n+2, etc. unless otherwise directed.
- Like Scanf and Fscanf, Sscanf need not consume its entire input.
- There is no way to recover how much of the input string Sscanf used.
+For example,
- Note: Fscan etc. can read one character (rune) past the input
- they return, which means that a loop calling a scan routine
- may skip some of the input. This is usually a problem only
- when there is no space between input values. If the reader
- provided to Fscan implements ReadRune, that method will be used
- to read characters. If the reader also implements UnreadRune,
- that method will be used to save the character and successive
- calls will not lose data. To attach ReadRune and UnreadRune
- methods to a reader without that capability, use
- bufio.NewReader.
+ fmt.Sprintf("%[2]d %[1]d\n", 11, 22)
+
+will yield "22 11", while
+
+ fmt.Sprintf("%[3]*.[2]*[1]f", 12.0, 2, 6)
+
+equivalent to
+
+ fmt.Sprintf("%6.2f", 12.0)
+
+will yield " 12.00". Because an explicit index affects subsequent verbs,
+this notation can be used to print the same values multiple times
+by resetting the index for the first argument to be repeated:
+
+ fmt.Sprintf("%d %d %#[1]x %#x", 16, 17)
+
+will yield "16 17 0x10 0x11".
+
+Format errors:
+
+If an invalid argument is given for a verb, such as providing
+a string to %d, the generated string will contain a
+description of the problem, as in these examples:
+
+ Wrong type or unknown verb: %!verb(type=value)
+ Printf("%d", hi): %!d(string=hi)
+ Too many arguments: %!(EXTRA type=value)
+ Printf("hi", "guys"): hi%!(EXTRA string=guys)
+ Too few arguments: %!verb(MISSING)
+ Printf("hi%d"): hi%!d(MISSING)
+ Non-int for width or precision: %!(BADWIDTH) or %!(BADPREC)
+ Printf("%*s", 4.5, "hi"): %!(BADWIDTH)hi
+ Printf("%.*s", 4.5, "hi"): %!(BADPREC)hi
+ Invalid or invalid use of argument index: %!(BADINDEX)
+ Printf("%*[2]d", 7): %!d(BADINDEX)
+ Printf("%.[2]d", 7): %!d(BADINDEX)
+
+All errors begin with the string "%!" followed sometimes
+by a single character (the verb) and end with a parenthesized
+description.
+
+If an Error or String method triggers a panic when called by a
+print routine, the fmt package reformats the error message
+from the panic, decorating it with an indication that it came
+through the fmt package. For example, if a String method
+calls panic("bad"), the resulting formatted message will look
+like
+
+ %!s(PANIC=bad)
+
+The %!s just shows the print verb in use when the failure
+occurred. If the panic is caused by a nil receiver to an Error
+or String method, however, the output is the undecorated
+string, "<nil>".
+
+# Scanning
+
+An analogous set of functions scans formatted text to yield
+values. Scan, Scanf and Scanln read from os.Stdin; Fscan,
+Fscanf and Fscanln read from a specified io.Reader; Sscan,
+Sscanf and Sscanln read from an argument string.
+
+Scan, Fscan, Sscan treat newlines in the input as spaces.
+
+Scanln, Fscanln and Sscanln stop scanning at a newline and
+require that the items be followed by a newline or EOF.
+
+Scanf, Fscanf, and Sscanf parse the arguments according to a
+format string, analogous to that of Printf. In the text that
+follows, 'space' means any Unicode whitespace character
+except newline.
+
+In the format string, a verb introduced by the % character
+consumes and parses input; these verbs are described in more
+detail below. A character other than %, space, or newline in
+the format consumes exactly that input character, which must
+be present. A newline with zero or more spaces before it in
+the format string consumes zero or more spaces in the input
+followed by a single newline or the end of the input. A space
+following a newline in the format string consumes zero or more
+spaces in the input. Otherwise, any run of one or more spaces
+in the format string consumes as many spaces as possible in
+the input. Unless the run of spaces in the format string
+appears adjacent to a newline, the run must consume at least
+one space from the input or find the end of the input.
+
+The handling of spaces and newlines differs from that of C's
+scanf family: in C, newlines are treated as any other space,
+and it is never an error when a run of spaces in the format
+string finds no spaces to consume in the input.
+
+The verbs behave analogously to those of Printf.
+For example, %x will scan an integer as a hexadecimal number,
+and %v will scan the default representation format for the value.
+The Printf verbs %p and %T and the flags # and + are not implemented.
+The verbs %e %E %f %F %g and %G are all equivalent and scan any
+floating-point or complex value. For float and complex literals in
+scientific notation, both the decimal (e) and binary (p) exponent
+formats are supported (for example: "2.3e+7" and "4.5p-8").
+
+Input processed by verbs is implicitly space-delimited: the
+implementation of every verb except %c starts by discarding
+leading spaces from the remaining input, and the %s verb
+(and %v reading into a string) stops consuming input at the first
+space or newline character.
+
+The familiar base-setting prefixes 0 (octal) and 0x
+(hexadecimal) are accepted when scanning integers without
+a format or with the %v verb.
+
+Width is interpreted in the input text but there is no
+syntax for scanning with a precision (no %5.2f, just %5f).
+If width is provided, it applies after leading spaces are
+trimmed and specifies the maximum number of runes to read
+to satisfy the verb. For example,
+
+ Sscanf(" 1234567 ", "%5s%d", &s, &i)
+
+will set s to "12345" and i to 67 while
+
+ Sscanf(" 12 34 567 ", "%5s%d", &s, &i)
+
+will set s to "12" and i to 34.
+
+In all the scanning functions, a carriage return followed
+immediately by a newline is treated as a plain newline
+(\r\n means the same as \n).
+
+In all the scanning functions, if an operand implements method
+Scan (that is, it implements the Scanner interface) that
+method will be used to scan the text for that operand. Also,
+if the number of arguments scanned is less than the number of
+arguments provided, an error is returned.
+
+All arguments to be scanned must be either pointers to basic
+types or implementations of the Scanner interface.
+
+Like Scanf and Fscanf, Sscanf need not consume its entire input.
+There is no way to recover how much of the input string Sscanf used.
+
+Note: Fscan etc. can read one character (rune) past the input
+they return, which means that a loop calling a scan routine
+may skip some of the input. This is usually a problem only
+when there is no space between input values. If the reader
+provided to Fscan implements ReadRune, that method will be used
+to read characters. If the reader also implements UnreadRune,
+that method will be used to save the character and successive
+calls will not lose data. To attach ReadRune and UnreadRune
+methods to a reader without that capability, use
+bufio.NewReader.
*/
package fmt
diff --git a/errors/fmt/print.go b/errors/fmt/print.go
index 0ba69b3..4a7fa52 100644
--- a/errors/fmt/print.go
+++ b/errors/fmt/print.go
@@ -48,7 +48,7 @@
type Formatter = gofmt.Formatter
// Stringer is implemented by any value that has a String method,
-// which defines the ``native'' format for that value.
+// which defines the “native” format for that value.
// The String method is used to print values passed as an operand
// to any format that accepts a string or to an unformatted printer
// such as Print.
diff --git a/event/adapter/gokit/gokit_test.go b/event/adapter/gokit/gokit_test.go
index 5db17dd..e12bdbf 100644
--- a/event/adapter/gokit/gokit_test.go
+++ b/event/adapter/gokit/gokit_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
package gokit_test
diff --git a/event/adapter/logfmt/logfmt.go b/event/adapter/logfmt/logfmt.go
index d635a48..5789e7a 100644
--- a/event/adapter/logfmt/logfmt.go
+++ b/event/adapter/logfmt/logfmt.go
@@ -16,7 +16,7 @@
"golang.org/x/exp/event"
)
-//TODO: some actual research into what this arbritray optimization number should be
+// TODO: some actual research into what this arbritray optimization number should be
const bufCap = 50
const TimeFormat = "2006/01/02 15:04:05"
diff --git a/event/adapter/logr/logr_test.go b/event/adapter/logr/logr_test.go
index 8dcb87b..f8d62f6 100644
--- a/event/adapter/logr/logr_test.go
+++ b/event/adapter/logr/logr_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
package logr_test
diff --git a/event/adapter/logrus/logrus.go b/event/adapter/logrus/logrus.go
index beef9d4..7924882 100644
--- a/event/adapter/logrus/logrus.go
+++ b/event/adapter/logrus/logrus.go
@@ -2,15 +2,19 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
// Package logrus provides a logrus Formatter for events.
// To use for the global logger:
-// logrus.SetFormatter(elogrus.NewFormatter(exporter))
-// logrus.SetOutput(io.Discard)
+//
+// logrus.SetFormatter(elogrus.NewFormatter(exporter))
+// logrus.SetOutput(io.Discard)
+//
// and for a Logger instance:
-// logger.SetFormatter(elogrus.NewFormatter(exporter))
-// logger.SetOutput(io.Discard)
+//
+// logger.SetFormatter(elogrus.NewFormatter(exporter))
+// logger.SetOutput(io.Discard)
//
// If you call elogging.SetExporter, then you can pass nil
// for the exporter above and it will use the global one.
diff --git a/event/adapter/logrus/logrus_test.go b/event/adapter/logrus/logrus_test.go
index bf8b850..6e76f3a 100644
--- a/event/adapter/logrus/logrus_test.go
+++ b/event/adapter/logrus/logrus_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
package logrus_test
diff --git a/event/adapter/zap/zap.go b/event/adapter/zap/zap.go
index df46bcc..c59d9a7 100644
--- a/event/adapter/zap/zap.go
+++ b/event/adapter/zap/zap.go
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
// zap provides an implementation of zapcore.Core for events.
// To use globally:
-// zap.ReplaceGlobals(zap.New(NewCore(exporter)))
+//
+// zap.ReplaceGlobals(zap.New(NewCore(exporter)))
//
// If you call elogging.SetExporter, then you can pass nil
// for the exporter above and it will use the global one.
diff --git a/event/adapter/zap/zap_test.go b/event/adapter/zap/zap_test.go
index 95f6849..787b6b4 100644
--- a/event/adapter/zap/zap_test.go
+++ b/event/adapter/zap/zap_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
package zap_test
diff --git a/event/alloc_test.go b/event/alloc_test.go
index 4e55395..5144645 100644
--- a/event/alloc_test.go
+++ b/event/alloc_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !race
// +build !race
package event_test
diff --git a/event/disabled.go b/event/disabled.go
index 20019ca..385a6c6 100644
--- a/event/disabled.go
+++ b/event/disabled.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build disable_events
// +build disable_events
package event
diff --git a/event/export.go b/event/export.go
index 0189599..b50f576 100644
--- a/event/export.go
+++ b/event/export.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
package event
diff --git a/event/severity/severity_test.go b/event/severity/severity_test.go
index 8825f23..5f31832 100644
--- a/event/severity/severity_test.go
+++ b/event/severity/severity_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
package severity_test
diff --git a/event/source.go b/event/source.go
index e9eaad3..05d9aa9 100644
--- a/event/source.go
+++ b/event/source.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !disable_events
// +build !disable_events
package event
@@ -40,7 +41,9 @@
// be used when capturing the source information on events.
// v should be either a string or a function pointer.
// If v is a string it is of the form
-// Space.Owner.Name
+//
+// Space.Owner.Name
+//
// where Owner and Name cannot contain '/' and Name also cannot contain '.'
func RegisterHelper(v interface{}) {
g := <-globalCallers
diff --git a/io/i2c/i2c.go b/io/i2c/i2c.go
index 6507254..192ad3d 100644
--- a/io/i2c/i2c.go
+++ b/io/i2c/i2c.go
@@ -4,7 +4,7 @@
// Package i2c allows users to read from and write to a slave I2C device.
//
-// Deprecated
+// # Deprecated
//
// This package is not maintained anymore. An actively supported cross-platform
// alternative is https://periph.io/.
diff --git a/io/spi/spi.go b/io/spi/spi.go
index 175e20d..a675bd1 100644
--- a/io/spi/spi.go
+++ b/io/spi/spi.go
@@ -4,7 +4,7 @@
// Package spi allows users to read from and write to an SPI device.
//
-// Deprecated
+// # Deprecated
//
// This package is not maintained anymore. An actively supported cross-platform
// alternative is https://periph.io/.
diff --git a/jsonrpc2/internal/stack/process.go b/jsonrpc2/internal/stack/process.go
index ac19366..8812de9 100644
--- a/jsonrpc2/internal/stack/process.go
+++ b/jsonrpc2/internal/stack/process.go
@@ -96,7 +96,7 @@
s.Calls[index].merge(gr)
}
-//TODO: do we want other grouping strategies?
+// TODO: do we want other grouping strategies?
func (c *Call) merge(gr Goroutine) {
for i := range c.Groups {
canditate := &c.Groups[i]
diff --git a/jsonrpc2/internal/stack/stacktest/stacktest.go b/jsonrpc2/internal/stack/stacktest/stacktest.go
index 560824c..bde66a5 100644
--- a/jsonrpc2/internal/stack/stacktest/stacktest.go
+++ b/jsonrpc2/internal/stack/stacktest/stacktest.go
@@ -11,7 +11,7 @@
"golang.org/x/exp/jsonrpc2/internal/stack"
)
-//this is only needed to support pre 1.14 when testing.TB did not have Cleanup
+// this is only needed to support pre 1.14 when testing.TB did not have Cleanup
type withCleanup interface {
Cleanup(func())
}
diff --git a/rand/exp.go b/rand/exp.go
index 4bc110f..0838672 100644
--- a/rand/exp.go
+++ b/rand/exp.go
@@ -26,8 +26,7 @@
// To produce a distribution with a different rate parameter,
// callers can adjust the output using:
//
-// sample = ExpFloat64() / desiredRateParameter
-//
+// sample = ExpFloat64() / desiredRateParameter
func (r *Rand) ExpFloat64() float64 {
for {
j := r.Uint32()
diff --git a/rand/normal.go b/rand/normal.go
index ba4ea54..b66da3a 100644
--- a/rand/normal.go
+++ b/rand/normal.go
@@ -33,8 +33,7 @@
// To produce a different normal distribution, callers can
// adjust the output using:
//
-// sample = NormFloat64() * desiredStdDev + desiredMean
-//
+// sample = NormFloat64() * desiredStdDev + desiredMean
func (r *Rand) NormFloat64() float64 {
for {
j := int32(r.Uint32()) // Possibly negative
diff --git a/rand/rand.go b/rand/rand.go
index 173c0f5..ee6161b 100644
--- a/rand/rand.go
+++ b/rand/rand.go
@@ -321,8 +321,7 @@
// To produce a different normal distribution, callers can
// adjust the output using:
//
-// sample = NormFloat64() * desiredStdDev + desiredMean
-//
+// sample = NormFloat64() * desiredStdDev + desiredMean
func NormFloat64() float64 { return globalRand.NormFloat64() }
// ExpFloat64 returns an exponentially distributed float64 in the range
@@ -331,8 +330,7 @@
// To produce a distribution with a different rate parameter,
// callers can adjust the output using:
//
-// sample = ExpFloat64() / desiredRateParameter
-//
+// sample = ExpFloat64() / desiredRateParameter
func ExpFloat64() float64 { return globalRand.ExpFloat64() }
// LockedSource is an implementation of Source that is concurrency-safe.
diff --git a/rand/rng.go b/rand/rng.go
index 17cee10..9b79108 100644
--- a/rand/rng.go
+++ b/rand/rng.go
@@ -13,10 +13,10 @@
// PCGSource is an implementation of a 64-bit permuted congruential
// generator as defined in
//
-// PCG: A Family of Simple Fast Space-Efficient Statistically Good
-// Algorithms for Random Number Generation
-// Melissa E. O’Neill, Harvey Mudd College
-// http://www.pcg-random.org/pdf/toms-oneill-pcg-family-v1.02.pdf
+// PCG: A Family of Simple Fast Space-Efficient Statistically Good
+// Algorithms for Random Number Generation
+// Melissa E. O’Neill, Harvey Mudd College
+// http://www.pcg-random.org/pdf/toms-oneill-pcg-family-v1.02.pdf
//
// The generator here is the congruential generator PCG XSL RR 128/64 (LCG)
// as found in the software available at http://www.pcg-random.org/.
diff --git a/shiny/driver/gldriver/cocoa.go b/shiny/driver/gldriver/cocoa.go
index 84bb393..db5ba63 100644
--- a/shiny/driver/gldriver/cocoa.go
+++ b/shiny/driver/gldriver/cocoa.go
@@ -411,6 +411,7 @@
// into the standard keycodes used by the key package.
//
// To get a sense of the key map, see the diagram on
+//
// http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
func cocoaKeyCode(vkcode uint16) key.Code {
switch vkcode {
diff --git a/shiny/example/basic/main.go b/shiny/example/basic/main.go
index 739faf6..8a35268 100644
--- a/shiny/example/basic/main.go
+++ b/shiny/example/basic/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/example/basicgl/main.go b/shiny/example/basicgl/main.go
index 6bd428f..b097180 100644
--- a/shiny/example/basicgl/main.go
+++ b/shiny/example/basicgl/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/example/fluid/main.go b/shiny/example/fluid/main.go
index 980f588..e410b42 100644
--- a/shiny/example/fluid/main.go
+++ b/shiny/example/fluid/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/example/goban/asset/resize.go b/shiny/example/goban/asset/resize.go
index 38e61fd..7d91152 100644
--- a/shiny/example/goban/asset/resize.go
+++ b/shiny/example/goban/asset/resize.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Custom image resizer. Saved for posterity.
diff --git a/shiny/example/goban/board.go b/shiny/example/goban/board.go
index f95e793..f176a90 100644
--- a/shiny/example/goban/board.go
+++ b/shiny/example/goban/board.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go board.go xy.go" to run it
diff --git a/shiny/example/goban/main.go b/shiny/example/goban/main.go
index dd02fae..f692b5c 100644
--- a/shiny/example/goban/main.go
+++ b/shiny/example/goban/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go board.go xy.go" to run it
diff --git a/shiny/example/goban/xy.go b/shiny/example/goban/xy.go
index cdacde6..7519e9c 100644
--- a/shiny/example/goban/xy.go
+++ b/shiny/example/goban/xy.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go board.go xy.go" to run it
diff --git a/shiny/example/goban/xy_test.go b/shiny/example/goban/xy_test.go
index 3d2e977..fa8e608 100644
--- a/shiny/example/goban/xy_test.go
+++ b/shiny/example/goban/xy_test.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// Use "go test -tags=example" to run this test.
diff --git a/shiny/example/icongallery/main.go b/shiny/example/icongallery/main.go
index efb8f12..5f7c9ad 100644
--- a/shiny/example/icongallery/main.go
+++ b/shiny/example/icongallery/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/example/imageview/main.go b/shiny/example/imageview/main.go
index 49ec839..0aa91fa 100644
--- a/shiny/example/imageview/main.go
+++ b/shiny/example/imageview/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/example/layout/main.go b/shiny/example/layout/main.go
index b5cac9d..a6f4532 100644
--- a/shiny/example/layout/main.go
+++ b/shiny/example/layout/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/example/textedit/main.go b/shiny/example/textedit/main.go
index e72358e..70ac599 100644
--- a/shiny/example/textedit/main.go
+++ b/shiny/example/textedit/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/example/tile/main.go b/shiny/example/tile/main.go
index dfb4526..c99e247 100644
--- a/shiny/example/tile/main.go
+++ b/shiny/example/tile/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/example/widgetgallery/main.go b/shiny/example/widgetgallery/main.go
index ed926a8..bbff7b6 100644
--- a/shiny/example/widgetgallery/main.go
+++ b/shiny/example/widgetgallery/main.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build example
// +build example
+
//
// This build tag means that "go install golang.org/x/exp/shiny/..." doesn't
// install this example program. Use "go run main.go" to run it or "go install
diff --git a/shiny/iconvg/upgrade.go b/shiny/iconvg/upgrade.go
index 6057391..5cfdef0 100644
--- a/shiny/iconvg/upgrade.go
+++ b/shiny/iconvg/upgrade.go
@@ -673,12 +673,13 @@
// E) form a parallelogram:
//
// E=A B
-// o---------o
-// \ \
-// \ \
-// \ \
-// o---------o
-// D C
+//
+// o---------o
+// \ \
+// \ \
+// \ \
+// o---------o
+// D C
//
// Specifically, it checks that (A == E) and ((A - B) == (D - C)). That last
// equation can be rearranged as (A == (B - C + D)).
@@ -700,15 +701,17 @@
// Let A± denote the two tangent vectors (A+ - A) and (A - A-) and likewise for
// B±, C± and D±.
//
-// A+ B-
+// A+ B-
+//
// E=A o o B
// A- o---------o B+
-// o \ \ o
-// \ X \
-// o \ \ o
-// D+ o---------o C-
-// D o o C
-// D- C+
+//
+// o \ \ o
+// \ X \
+// o \ \ o
+// D+ o---------o C-
+// D o o C
+// D- C+
//
// See https://nigeltao.github.io/blog/2021/three-points-define-ellipse.html
// for a better version of that ASCII art.
diff --git a/shiny/materialdesign/icons/gen.go b/shiny/materialdesign/icons/gen.go
index b67a606..473d2a7 100644
--- a/shiny/materialdesign/icons/gen.go
+++ b/shiny/materialdesign/icons/gen.go
@@ -40,7 +40,9 @@
//
// When manually debugging one particular icon, it can be useful to add
// something like:
-// if baseName != "check_box" { return errSkip }
+//
+// if baseName != "check_box" { return errSkip }
+//
// at the top of func genFile.
var errSkip = errors.New("skipping SVG to IconVG conversion")
diff --git a/shiny/text/caret.go b/shiny/text/caret.go
index 87da5f6..24daa96 100644
--- a/shiny/text/caret.go
+++ b/shiny/text/caret.go
@@ -104,7 +104,9 @@
// Diagramatically, suppose we have two adjacent boxes (shown by square
// brackets below), with the Caret (an integer location called Caret.pos in the
// Frame's text) in the middle of the "foo2bar3" word:
+//
// [foo0 foo1 foo2]^[bar3 bar4 bar5]
+//
// leanForwards moves Caret.k from fooBox.j to barBox.i, also updating the
// Caret's p, l and b. Caret.pos remains unchanged.
func (c *Caret) leanForwards() leanResult {
diff --git a/shootout/binary-tree-freelist.go b/shootout/binary-tree-freelist.go
index eab6bb3..e4c3e8a 100644
--- a/shootout/binary-tree-freelist.go
+++ b/shootout/binary-tree-freelist.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/binary-tree.go b/shootout/binary-tree.go
index fe5844f..5f6cb34 100644
--- a/shootout/binary-tree.go
+++ b/shootout/binary-tree.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/chameneosredux.go b/shootout/chameneosredux.go
index 16fa8b9..80bea32 100644
--- a/shootout/chameneosredux.go
+++ b/shootout/chameneosredux.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/fannkuch-parallel.go b/shootout/fannkuch-parallel.go
index 96a4e45..a69b09c 100644
--- a/shootout/fannkuch-parallel.go
+++ b/shootout/fannkuch-parallel.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/fannkuch.go b/shootout/fannkuch.go
index 5ba751f..4f07dff 100644
--- a/shootout/fannkuch.go
+++ b/shootout/fannkuch.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/fasta.go b/shootout/fasta.go
index fa9569a..3890113 100644
--- a/shootout/fasta.go
+++ b/shootout/fasta.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/k-nucleotide-parallel.go b/shootout/k-nucleotide-parallel.go
index 348d285..8b25419 100644
--- a/shootout/k-nucleotide-parallel.go
+++ b/shootout/k-nucleotide-parallel.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/k-nucleotide.go b/shootout/k-nucleotide.go
index 2962a69..efc8d95 100644
--- a/shootout/k-nucleotide.go
+++ b/shootout/k-nucleotide.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/mandelbrot.go b/shootout/mandelbrot.go
index d433554..2b82a2f 100644
--- a/shootout/mandelbrot.go
+++ b/shootout/mandelbrot.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/meteor-contest.go b/shootout/meteor-contest.go
index ea5d44b..cfe49ec 100644
--- a/shootout/meteor-contest.go
+++ b/shootout/meteor-contest.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/nbody.go b/shootout/nbody.go
index 1034221..4eeba44 100644
--- a/shootout/nbody.go
+++ b/shootout/nbody.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/pidigits.go b/shootout/pidigits.go
index a5cced3..16f8f81 100644
--- a/shootout/pidigits.go
+++ b/shootout/pidigits.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/regex-dna-parallel.go b/shootout/regex-dna-parallel.go
index a3be491..68ccd76 100644
--- a/shootout/regex-dna-parallel.go
+++ b/shootout/regex-dna-parallel.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/regex-dna.go b/shootout/regex-dna.go
index 24600a0..85e1939 100644
--- a/shootout/regex-dna.go
+++ b/shootout/regex-dna.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/reverse-complement.go b/shootout/reverse-complement.go
index 9d4b6bf..11b59d2 100644
--- a/shootout/reverse-complement.go
+++ b/shootout/reverse-complement.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/spectral-norm-parallel.go b/shootout/spectral-norm-parallel.go
index 5c976ff..5ad4e20 100644
--- a/shootout/spectral-norm-parallel.go
+++ b/shootout/spectral-norm-parallel.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/spectral-norm.go b/shootout/spectral-norm.go
index 5ca33dc..fb41051 100644
--- a/shootout/spectral-norm.go
+++ b/shootout/spectral-norm.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/shootout/threadring.go b/shootout/threadring.go
index 316bf61..035867f 100644
--- a/shootout/threadring.go
+++ b/shootout/threadring.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
/*
diff --git a/sumdb/gosumcheck/main.go b/sumdb/gosumcheck/main.go
index bb3bb4f..cd7aef2 100644
--- a/sumdb/gosumcheck/main.go
+++ b/sumdb/gosumcheck/main.go
@@ -28,7 +28,6 @@
//
// To discourage misuse in automated settings, gosumcheck does not
// set any exit status to report whether any problems were found.
-//
package main
import (
diff --git a/sumdb/internal/note/note.go b/sumdb/internal/note/note.go
index 4b25773..5fe2481 100644
--- a/sumdb/internal/note/note.go
+++ b/sumdb/internal/note/note.go
@@ -23,7 +23,7 @@
// the concatenation of the server name, a newline, and
// the encoded public key.
//
-// Verifying Notes
+// # Verifying Notes
//
// A Verifier allows verification of signatures by one server public key.
// It can report the name of the server and the uint32 hash of the key,
@@ -50,7 +50,7 @@
// the message signatures and returns a Note structure
// containing the message text and (verified or unverified) signatures.
//
-// Signing Notes
+// # Signing Notes
//
// A Signer allows signing a text with a given key.
// It can report the name of the server and the hash of the key
@@ -66,7 +66,7 @@
// The Sign function takes as input a Note and a list of Signers
// and returns an encoded, signed message.
//
-// Signed Note Format
+// # Signed Note Format
//
// A signed note consists of a text ending in newline (U+000A),
// followed by a blank line (only a newline),
@@ -88,7 +88,7 @@
// to sign the note text (including the final newline but not the
// separating blank line).
//
-// Generating Keys
+// # Generating Keys
//
// There is only one key type, Ed25519 with algorithm identifier 1.
// New key types may be introduced in the future as needed,
@@ -98,7 +98,7 @@
// The GenerateKey function generates and returns a new signer
// and corresponding verifier.
//
-// Example
+// # Example
//
// Here is a well-formed signed note:
//
@@ -178,7 +178,6 @@
//
// — PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=
// — EnochRoot rwz+eBzmZa0SO3NbfRGzPCpDckykFXSdeX+MNtCOXm2/5n2tiOHp+vAF1aGrQ5ovTG01oOTGwnWLox33WWd1RvMc+QQ=
-//
package note
import (
diff --git a/sumdb/internal/sumweb/server.go b/sumdb/internal/sumweb/server.go
index 522d332..d25f5a3 100644
--- a/sumdb/internal/sumweb/server.go
+++ b/sumdb/internal/sumweb/server.go
@@ -52,7 +52,6 @@
// for _, path := range sumweb.Paths {
// http.HandleFunc(path, handler)
// }
-//
var Paths = []string{
"/lookup/",
"/latest",
diff --git a/sumdb/internal/tlog/tlog.go b/sumdb/internal/tlog/tlog.go
index 3dd75da..732316f 100644
--- a/sumdb/internal/tlog/tlog.go
+++ b/sumdb/internal/tlog/tlog.go
@@ -11,7 +11,6 @@
// This package follows the design of Certificate Transparency (RFC 6962)
// and its proofs are compatible with that system.
// See TestCertificateTransparency.
-//
package tlog
import (
diff --git a/typeparams/common.go b/typeparams/common.go
index 0193388..7f867cf 100644
--- a/typeparams/common.go
+++ b/typeparams/common.go
@@ -123,15 +123,15 @@
//
// For example, consider the following type declarations:
//
-// type Interface[T any] interface {
-// Accept(T)
-// }
+// type Interface[T any] interface {
+// Accept(T)
+// }
//
-// type Container[T any] struct {
-// Element T
-// }
+// type Container[T any] struct {
+// Element T
+// }
//
-// func (c Container[T]) Accept(t T) { c.Element = t }
+// func (c Container[T]) Accept(t T) { c.Element = t }
//
// In this case, GenericAssignableTo reports that instantiations of Container
// are assignable to the corresponding instantiation of Interface.
diff --git a/typeparams/example/findtypeparams/main.go b/typeparams/example/findtypeparams/main.go
index fad6f0a..50a1fcc 100644
--- a/typeparams/example/findtypeparams/main.go
+++ b/typeparams/example/findtypeparams/main.go
@@ -36,7 +36,7 @@
//!-input
`
func PrintTypeParams(fset *token.FileSet, file *ast.File) error {
conf := types.Config{Importer: importer.Default()}
info := &types.Info{
diff --git a/typeparams/example/genericmethods/main.go b/typeparams/example/genericmethods/main.go
index 7673691..8acdcf2 100644
--- a/typeparams/example/genericmethods/main.go
+++ b/typeparams/example/genericmethods/main.go
@@ -39,7 +39,7 @@
//!-input
`
-//!+printmethods
+// !+printmethods
func PrintMethods(pkg *types.Package) {
// Look up *Named types in the package scope.
lookup := func(name string) *types.Named {
@@ -84,7 +84,7 @@
//!-printoutput
*/
-//!+compareorigins
+// !+compareorigins
func CompareOrigins(pkg *types.Package) {
Pair := pkg.Scope().Lookup("Pair").Type().(*types.Named)
IntPair := pkg.Scope().Lookup("IntPair").Type().(*types.Named)
diff --git a/typeparams/example/implicit/main.go b/typeparams/example/implicit/main.go
index 8894de5..996ad2c 100644
--- a/typeparams/example/implicit/main.go
+++ b/typeparams/example/implicit/main.go
@@ -19,7 +19,7 @@
//!-input
`
-//!+show
+// !+show
func ShowImplicit(pkg *types.Package) {
Square := pkg.Scope().Lookup("Square").Type().(*types.Signature)
N := Square.TypeParams().At(0)
diff --git a/typeparams/example/instantiation/main.go b/typeparams/example/instantiation/main.go
index 66c7be2..11e19c1 100644
--- a/typeparams/example/instantiation/main.go
+++ b/typeparams/example/instantiation/main.go
@@ -42,7 +42,7 @@
//!-input
`
-//!+check
+// !+check
func CheckInstances(fset *token.FileSet, file *ast.File) (*types.Package, error) {
conf := types.Config{}
info := &types.Info{
@@ -82,7 +82,7 @@
return buf.String()
}
-//!+instantiate
+// !+instantiate
func Instantiate(pkg *types.Package) error {
Pair := pkg.Scope().Lookup("Pair").Type()
X := pkg.Scope().Lookup("X").Type()
diff --git a/typeparams/example/interfaces/main.go b/typeparams/example/interfaces/main.go
index c19a210..9f9ac62 100644
--- a/typeparams/example/interfaces/main.go
+++ b/typeparams/example/interfaces/main.go
@@ -43,7 +43,7 @@
//!-input
`
-//!+printsyntax
+// !+printsyntax
func PrintNumericSyntax(fset *token.FileSet, file *ast.File) {
// node is the AST node corresponding to the declaration for "Numeric."
node := file.Scope.Lookup("Numeric").Decl.(*ast.TypeSpec)
@@ -80,7 +80,7 @@
//!-outputsyntax
*/
-//!+printtypes
+// !+printtypes
func PrintInterfaceTypes(fset *token.FileSet, file *ast.File) error {
conf := types.Config{}
pkg, err := conf.Check("hello", fset, []*ast.File{file}, nil)
diff --git a/typeparams/example/methoddecls/main.go b/typeparams/example/methoddecls/main.go
index 00779c1..da19bef 100644
--- a/typeparams/example/methoddecls/main.go
+++ b/typeparams/example/methoddecls/main.go
@@ -50,7 +50,7 @@
//!-input
`
-//!+describe
+// !+describe
func Describe(fset *token.FileSet, file *ast.File) error {
conf := types.Config{Importer: importer.Default()}
info := &types.Info{
diff --git a/typeparams/example/predicates/main.go b/typeparams/example/predicates/main.go
index c22b4a0..5237c06 100644
--- a/typeparams/example/predicates/main.go
+++ b/typeparams/example/predicates/main.go
@@ -51,7 +51,7 @@
//!-input
`
-//!+ordinary
+// !+ordinary
func OrdinaryPredicates(pkg *types.Package) {
var (
Pair = pkg.Scope().Lookup("Pair").Type()
@@ -79,7 +79,7 @@
//!-ordinaryoutput
*/
-//!+generic
+// !+generic
func GenericPredicates(pkg *types.Package) {
var (
Pair = pkg.Scope().Lookup("Pair").Type()
diff --git a/typeparams/example/typesets/main.go b/typeparams/example/typesets/main.go
index b26dbc7..05da8be 100644
--- a/typeparams/example/typesets/main.go
+++ b/typeparams/example/typesets/main.go
@@ -29,7 +29,7 @@
//!-input
`
func PrintNormalTerms(pkg *types.Package) error {
D := pkg.Scope().Lookup("D").Type()
terms, err := typeparams.NormalTerms(D)
diff --git a/typeparams/normalize.go b/typeparams/normalize.go
index ffb4e2b..6cf71f0 100644
--- a/typeparams/normalize.go
+++ b/typeparams/normalize.go
@@ -36,13 +36,13 @@
// restrictions may be arbitrarily complex. For example, consider the
// following:
//
-// type A interface{ ~string|~[]byte }
+// type A interface{ ~string|~[]byte }
//
-// type B interface{ int|string }
+// type B interface{ int|string }
//
-// type C interface { ~string|~int }
+// type C interface { ~string|~int }
//
-// type T[P interface{ A|B; C }] int
+// type T[P interface{ A|B; C }] int
//
// In this example, the structural type restriction of P is ~string|int: A|B
// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int,
diff --git a/typeparams/typeterm.go b/typeparams/typeterm.go
index 7ddee28..7350bb7 100644
--- a/typeparams/typeterm.go
+++ b/typeparams/typeterm.go
@@ -10,11 +10,10 @@
// A term describes elementary type sets:
//
-// ∅: (*term)(nil) == ∅ // set of no types (empty set)
-// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse)
-// T: &term{false, T} == {T} // set of type T
-// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t
-//
+// ∅: (*term)(nil) == ∅ // set of no types (empty set)
+// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse)
+// T: &term{false, T} == {T} // set of type T
+// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t
type term struct {
tilde bool // valid if typ != nil
typ types.Type
diff --git a/winfsnotify/winfsnotify.go b/winfsnotify/winfsnotify.go
index 6781291..8c7c43f 100644
--- a/winfsnotify/winfsnotify.go
+++ b/winfsnotify/winfsnotify.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
// Package winfsnotify allows the user to receive
diff --git a/winfsnotify/winfsnotify_test.go b/winfsnotify/winfsnotify_test.go
index a0bd432..de4f514 100644
--- a/winfsnotify/winfsnotify_test.go
+++ b/winfsnotify/winfsnotify_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
package winfsnotify
To view, visit change 399614. To unsubscribe, or for help writing mail filters, visit settings.