Skip to content

Commit bcd2187

Browse files
rscgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Russ Cox <[email protected]>
1 parent 7b9b53b commit bcd2187

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+578
-478
lines changed

Diff for: apidiff/compatibility.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,16 @@ func unexportedMethod(t *types.Interface) *types.Func {
134134
}
135135

136136
// We need to check three things for structs:
137-
// 1. The set of exported fields must be compatible. This ensures that keyed struct
138-
// literals continue to compile. (There is no compatibility guarantee for unkeyed
139-
// struct literals.)
140-
// 2. The set of exported *selectable* fields must be compatible. This includes the exported
141-
// fields of all embedded structs. This ensures that selections continue to compile.
142-
// 3. If the old struct is comparable, so must the new one be. This ensures that equality
143-
// expressions and uses of struct values as map keys continue to compile.
137+
//
138+
// 1. The set of exported fields must be compatible. This ensures that keyed struct
139+
// literals continue to compile. (There is no compatibility guarantee for unkeyed
140+
// struct literals.)
141+
//
142+
// 2. The set of exported *selectable* fields must be compatible. This includes the exported
143+
// fields of all embedded structs. This ensures that selections continue to compile.
144+
//
145+
// 3. If the old struct is comparable, so must the new one be. This ensures that equality
146+
// expressions and uses of struct values as map keys continue to compile.
144147
//
145148
// An unexported embedded struct can't appear in a struct literal outside the
146149
// package, so it doesn't have to be present, or have the same name, in the new

Diff for: apidiff/testdata/exported_fields/ef.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package exported_fields
22

33
// Used for testing exportedFields.
44
// Its exported fields are:
5-
// A1 [1]int
6-
// D bool
7-
// E int
8-
// F F
9-
// S *S
5+
//
6+
// A1 [1]int
7+
// D bool
8+
// E int
9+
// F F
10+
// S *S
1011
type (
1112
S struct {
1213
int

Diff for: apidiff/testdata/tests.go

+28-25
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
// This file is split into two packages, old and new.
22
// It is syntactically valid Go so that gofmt can process it.
33
//
4-
// If a comment begins with: Then:
5-
// old write subsequent lines to the "old" package
6-
// new write subsequent lines to the "new" package
7-
// both write subsequent lines to both packages
8-
// c expect a compatible error with the following text
9-
// i expect an incompatible error with the following text
4+
// If a comment begins with: Then:
5+
// old write subsequent lines to the "old" package
6+
// new write subsequent lines to the "new" package
7+
// both write subsequent lines to both packages
8+
// c expect a compatible error with the following text
9+
// i expect an incompatible error with the following text
1010
package ignore
1111

1212
// both
1313
import "io"
1414

1515
//////////////// Basics
1616

17-
//// Same type in both: OK.
17+
// Same type in both: OK.
1818
// both
1919
type A int
2020

21-
//// Changing the type is an incompatible change.
21+
// Changing the type is an incompatible change.
2222
// old
2323
type B int
2424

2525
// new
2626
// i B: changed from int to string
2727
type B string
2828

29-
//// Adding a new type, whether alias or not, is a compatible change.
29+
// Adding a new type, whether alias or not, is a compatible change.
3030
// new
3131
// c AA: added
3232
type AA = A
3333

3434
// c B1: added
3535
type B1 bool
3636

37-
//// Change of type for an unexported name doesn't matter...
37+
// Change of type for an unexported name doesn't matter...
3838
// old
3939
type t int
4040

4141
// new
4242
type t string // OK: t isn't part of the API
4343

44-
//// ...unless it is exposed.
44+
// ...unless it is exposed.
4545
// both
4646
var V2 u
4747

@@ -52,7 +52,7 @@ type u string
5252
// i u: changed from string to int
5353
type u int
5454

55-
//// An exposed, unexported type can be renamed.
55+
// An exposed, unexported type can be renamed.
5656
// both
5757
type u2 int
5858

@@ -64,7 +64,7 @@ var V5 u1
6464
// new
6565
var V5 u2 // OK: V5 has changed type, but old u1 corresopnds to new u2
6666

67-
//// Splitting a single type into two is an incompatible change.
67+
// Splitting a single type into two is an incompatible change.
6868
// both
6969
type u3 int
7070

@@ -83,7 +83,7 @@ type (
8383
Split2 = u3
8484
)
8585

86-
//// Merging two types into one is OK.
86+
// Merging two types into one is OK.
8787
// old
8888
type (
8989
GoodMerge1 = u2
@@ -96,7 +96,7 @@ type (
9696
GoodMerge2 = u3
9797
)
9898

99-
//// Merging isn't OK here because a method is lost.
99+
// Merging isn't OK here because a method is lost.
100100
// both
101101
type u4 int
102102

@@ -125,7 +125,7 @@ type Rem int
125125

126126
//////////////// Constants
127127

128-
//// type changes
128+
// type changes
129129
// old
130130
const (
131131
C1 = 1
@@ -172,7 +172,7 @@ const (
172172

173173
//////////////// Variables
174174

175-
//// simple type changes
175+
// simple type changes
176176
// old
177177
var (
178178
V1 string
@@ -189,7 +189,7 @@ var (
189189
V7 chan int
190190
)
191191

192-
//// interface type changes
192+
// interface type changes
193193
// old
194194
var (
195195
V9 interface{ M() }
@@ -210,7 +210,7 @@ var (
210210
V11 interface{ M(int) }
211211
)
212212

213-
//// struct type changes
213+
// struct type changes
214214
// old
215215
var (
216216
VS1 struct{ A, B int }
@@ -413,7 +413,8 @@ type I5 = io.Writer
413413
// i I5: changed from io.Writer to I5
414414
// In old, I5 and io.Writer are the same type; in new,
415415
// they are different. That can break something like:
416-
// var _ func(io.Writer) = func(pkg.I6) {}
416+
//
417+
// var _ func(io.Writer) = func(pkg.I6) {}
417418
type I5 io.Writer
418419

419420
// old
@@ -471,7 +472,9 @@ type t4 int
471472

472473
// i VT4: changed from int to t4
473474
// This is incompatible because of code like
474-
// VT4 + int(1)
475+
//
476+
// VT4 + int(1)
477+
//
475478
// which works in old but fails in new.
476479
// The difference from the above cases is that
477480
// in those, we were merging two types into one;
@@ -627,7 +630,7 @@ type S4 struct {
627630
*S4 // OK: same (recursive embedding)
628631
}
629632

630-
//// Difference between exported selectable fields and exported immediate fields.
633+
// Difference between exported selectable fields and exported immediate fields.
631634
// both
632635
type S5 struct{ A int }
633636

@@ -648,7 +651,7 @@ type S6 struct {
648651
S5
649652
}
650653

651-
//// Ambiguous fields can exist; they just can't be selected.
654+
// Ambiguous fields can exist; they just can't be selected.
652655
// both
653656
type (
654657
embed7a struct{ E int }
@@ -870,7 +873,7 @@ type H interface {
870873

871874
//// Splitting types
872875

873-
//// OK: in both old and new, {J1, K1, L1} name the same type.
876+
// OK: in both old and new, {J1, K1, L1} name the same type.
874877
// old
875878
type (
876879
J1 = K1
@@ -885,7 +888,7 @@ type (
885888
L1 = J1
886889
)
887890

888-
//// Old has one type, K2; new has J2 and K2.
891+
// Old has one type, K2; new has J2 and K2.
889892
// both
890893
type K2 int
891894

Diff for: cmd/gorelease/gorelease.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
//
88
// Usage:
99
//
10-
// gorelease [-base={version|none}] [-version=version]
10+
// gorelease [-base={version|none}] [-version=version]
1111
//
1212
// Examples:
1313
//
14-
// # Compare with the latest version and suggest a new version.
15-
// gorelease
14+
// # Compare with the latest version and suggest a new version.
15+
// gorelease
1616
//
17-
// # Compare with a specific version and suggest a new version.
18-
// gorelease -base=v1.2.3
17+
// # Compare with a specific version and suggest a new version.
18+
// gorelease -base=v1.2.3
1919
//
20-
// # Compare with the latest version and check a specific new version for compatibility.
21-
// gorelease -version=v1.3.0
20+
// # Compare with the latest version and check a specific new version for compatibility.
21+
// gorelease -version=v1.3.0
2222
//
23-
// # Compare with a specific version and check a specific new version for compatibility.
24-
// gorelease -base=v1.2.3 -version=v1.3.0
23+
// # Compare with a specific version and check a specific new version for compatibility.
24+
// gorelease -base=v1.2.3 -version=v1.3.0
2525
//
2626
// gorelease analyzes changes in the public API and dependencies of the main
2727
// module. It compares a base version (set with -base) with the currently

Diff for: cmd/macos-roots-test/root_darwin.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ var debugDarwinRoots = true
2929
//
3030
// The strategy is as follows:
3131
//
32-
// 1. Run "security find-certificate" to dump the list of system root
33-
// CAs in PEM format.
32+
// 1. Run "security find-certificate" to dump the list of system root
33+
// CAs in PEM format.
3434
//
35-
// 2. For each dumped cert, conditionally verify it with "security
36-
// verify-cert" if that cert was not in the SystemRootCertificates
37-
// keychain, which can't have custom trust policies.
35+
// 2. For each dumped cert, conditionally verify it with "security
36+
// verify-cert" if that cert was not in the SystemRootCertificates
37+
// keychain, which can't have custom trust policies.
3838
//
3939
// We need to run "verify-cert" for all certificates not in SystemRootCertificates
4040
// because there might be certificates in the keychains without a corresponding

Diff for: cmd/txtar/txtar.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
//
2626
// Example usage:
2727
//
28-
// txtar *.go <README >testdata/example.txt
29-
//
30-
// txtar --extract <playground_example.txt >main.go
28+
// txtar *.go <README >testdata/example.txt
3129
//
30+
// txtar --extract <playground_example.txt >main.go
3231
package main
3332

3433
import (

Diff for: ebnf/ebnf.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
// non-terminal productions (i.e., productions which allow white-space
2020
// and comments between tokens); all other production names denote
2121
// lexical productions.
22-
//
2322
package ebnf // import "golang.org/x/exp/ebnf"
2423

2524
import (
@@ -256,12 +255,11 @@ func (v *verifier) verify(grammar Grammar, start string) {
256255
}
257256

258257
// Verify checks that:
259-
// - all productions used are defined
260-
// - all productions defined are used when beginning at start
261-
// - lexical productions refer only to other lexical productions
258+
// - all productions used are defined
259+
// - all productions defined are used when beginning at start
260+
// - lexical productions refer only to other lexical productions
262261
//
263262
// Position information is interpreted relative to the file set fset.
264-
//
265263
func Verify(grammar Grammar, start string) error {
266264
var v verifier
267265
v.verify(grammar, start)

Diff for: ebnf/parser.go

-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ func (p *parser) parse(filename string, src io.Reader) Grammar {
182182
// for incorrect syntax and if a production is declared
183183
// more than once; the filename is used only for error
184184
// positions.
185-
//
186185
func Parse(filename string, src io.Reader) (Grammar, error) {
187186
var p parser
188187
grammar := p.parse(filename, src)

Diff for: ebnflint/doc.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
// license that can be found in the LICENSE file.
44

55
/*
6-
76
Ebnflint verifies that EBNF productions are consistent and grammatically correct.
87
It reads them from an HTML document such as the Go specification.
98
109
Grammar productions are grouped in boxes demarcated by the HTML elements
10+
1111
<pre class="ebnf">
1212
</pre>
1313
14-
1514
Usage:
15+
1616
go tool ebnflint [--start production] [file]
1717
1818
The --start flag specifies the name of the start production for
1919
the grammar; it defaults to "Start".
20-
2120
*/
2221
package main // import "golang.org/x/exp/ebnflint"

Diff for: errors/errors.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// Package errors implements functions to manipulate errors.
66
//
77
// This package implements the Go 2 draft designs for error inspection and printing:
8-
// https://go.googlesource.com/proposal/+/master/design/go2draft.md
8+
//
9+
// https://go.googlesource.com/proposal/+/master/design/go2draft.md
910
//
1011
// This is an EXPERIMENTAL package, and may change in arbitrary ways without notice.
1112
package errors

0 commit comments

Comments
 (0)