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 <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox 2022-04-11 13:08:42 -04:00 коммит произвёл Gopher Robot
Родитель 7b9b53b0ac
Коммит bcd21879b8
85 изменённых файлов: 525 добавлений и 425 удалений

Просмотреть файл

@ -134,13 +134,16 @@ func unexportedMethod(t *types.Interface) *types.Func {
}
// 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

11
apidiff/testdata/exported_fields/ef.go поставляемый
Просмотреть файл

@ -2,11 +2,12 @@ package exported_fields
// 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

53
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 @@ import "io"
//////////////// 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 @@ type B int
// 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 @@ type AA = A
// 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 @@ type u string
// 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 @@ var V5 u1
// 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 @@ type (
Split2 = u3
)
//// Merging two types into one is OK.
// Merging two types into one is OK.
// old
type (
GoodMerge1 = u2
@ -96,7 +96,7 @@ type (
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 @@ type Rem int
//////////////// Constants
//// type changes
// type changes
// old
const (
C1 = 1
@ -172,7 +172,7 @@ const (
//////////////// Variables
//// simple type changes
// simple type changes
// old
var (
V1 string
@ -189,7 +189,7 @@ var (
V7 chan int
)
//// interface type changes
// interface type changes
// old
var (
V9 interface{ M() }
@ -210,7 +210,7 @@ var (
V11 interface{ M(int) }
)
//// struct type changes
// struct type changes
// old
var (
VS1 struct{ A, B int }
@ -413,7 +413,8 @@ type I5 = io.Writer
// 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 @@ type t4 int
// 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 @@ type S4 struct {
*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 @@ type S6 struct {
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 @@ type H interface {
//// 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 @@ type (
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

Просмотреть файл

@ -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

Просмотреть файл

@ -29,12 +29,12 @@ var debugDarwinRoots = true
//
// 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

Просмотреть файл

@ -25,10 +25,9 @@
//
// Example usage:
//
// txtar *.go <README >testdata/example.txt
//
// txtar --extract <playground_example.txt >main.go
// txtar *.go <README >testdata/example.txt
//
// txtar --extract <playground_example.txt >main.go
package main
import (

Просмотреть файл

@ -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 @@ func (v *verifier) verify(grammar Grammar, start string) {
}
// 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)

Просмотреть файл

@ -182,7 +182,6 @@ func (p *parser) parse(filename string, src io.Reader) Grammar {
// 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)

Просмотреть файл

@ -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"

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -48,7 +48,7 @@ type State = gofmt.State
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.

Просмотреть файл

@ -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

Просмотреть файл

@ -16,7 +16,7 @@ import (
"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"

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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 @@ var globalCallers chan *sources
// 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

Просмотреть файл

@ -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/.

Просмотреть файл

@ -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/.

Просмотреть файл

@ -96,7 +96,7 @@ func (s *Summary) addGoroutine(gr Goroutine) {
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]

Просмотреть файл

@ -11,7 +11,7 @@ import (
"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())
}

Просмотреть файл

@ -26,8 +26,7 @@ const (
// 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()

Просмотреть файл

@ -33,8 +33,7 @@ func absInt32(i int32) uint32 {
// 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

Просмотреть файл

@ -321,8 +321,7 @@ func Read(p []byte) (n int, err error) { return globalRand.Read(p) }
// 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 @@ func NormFloat64() float64 { return globalRand.NormFloat64() }
// 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.

Просмотреть файл

@ -13,10 +13,10 @@ import (
// 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. ONeill, 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. ONeill, 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/.

Просмотреть файл

@ -411,6 +411,7 @@ func cocoaRune(r rune) rune {
// 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 {

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -673,12 +673,13 @@ func (u *upgrader) looksLikeParallelogram3(curr *[2]float32, args [][2]float32,
// 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 @@ func (u *upgrader) looksLikeParallelogram4(curr *[2]float32, args [][2]float32)
// 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.

Просмотреть файл

@ -40,7 +40,9 @@ const outSize = 48
//
// 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")

Просмотреть файл

@ -104,7 +104,9 @@ const (
// 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 {

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
/*

Просмотреть файл

@ -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 (

Просмотреть файл

@ -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 (

Просмотреть файл

@ -52,7 +52,6 @@ type Handler struct {
// for _, path := range sumweb.Paths {
// http.HandleFunc(path, handler)
// }
//
var Paths = []string{
"/lookup/",
"/latest",

Просмотреть файл

@ -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 (

Просмотреть файл

@ -123,15 +123,15 @@ func OriginMethod(fn *types.Func) *types.Func {
//
// 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.

Просмотреть файл

@ -36,7 +36,7 @@ func MakePair[L, R Constraint](l L, r R) Pair[L, R] {
//!-input
`
//!+print
// !+print
func PrintTypeParams(fset *token.FileSet, file *ast.File) error {
conf := types.Config{Importer: importer.Default()}
info := &types.Info{

Просмотреть файл

@ -39,7 +39,7 @@ var IntPair Pair[int, int]
//!-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 @@ func (p.Pair[L, _]).Right() _
//!-printoutput
*/
//!+compareorigins
// !+compareorigins
func CompareOrigins(pkg *types.Package) {
Pair := pkg.Scope().Lookup("Pair").Type().(*types.Named)
IntPair := pkg.Scope().Lookup("IntPair").Type().(*types.Named)

Просмотреть файл

@ -19,7 +19,7 @@ func Square[N ~int|~float64](n N) N {
//!-input
`
//!+show
// !+show
func ShowImplicit(pkg *types.Package) {
Square := pkg.Scope().Lookup("Square").Type().(*types.Signature)
N := Square.TypeParams().At(0)

Просмотреть файл

@ -42,7 +42,7 @@ var E = Equal[int, string]
//!-input
`
//!+check
// !+check
func CheckInstances(fset *token.FileSet, file *ast.File) (*types.Package, error) {
conf := types.Config{}
info := &types.Info{
@ -82,7 +82,7 @@ func FormatTypeList(list *types.TypeList) string {
return buf.String()
}
//!+instantiate
// !+instantiate
func Instantiate(pkg *types.Package) error {
Pair := pkg.Scope().Lookup("Pair").Type()
X := pkg.Scope().Lookup("X").Type()

Просмотреть файл

@ -43,7 +43,7 @@ func Find[T Findable](s []T, v T) int {
//!-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 @@ func PrintNumericSyntax(fset *token.FileSet, file *ast.File) {
//!-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)

Просмотреть файл

@ -50,7 +50,7 @@ func (p Pair[L, R]) Equal(other Pair[L, R]) bool {
//!-input
`
//!+describe
// !+describe
func Describe(fset *token.FileSet, file *ast.File) error {
conf := types.Config{Importer: importer.Default()}
info := &types.Info{

Просмотреть файл

@ -51,7 +51,7 @@ func H[R ~int](R) int { return 2 }
//!-input
`
//!+ordinary
// !+ordinary
func OrdinaryPredicates(pkg *types.Package) {
var (
Pair = pkg.Scope().Lookup("Pair").Type()
@ -79,7 +79,7 @@ Identical(F, H) false
//!-ordinaryoutput
*/
//!+generic
// !+generic
func GenericPredicates(pkg *types.Package) {
var (
Pair = pkg.Scope().Lookup("Pair").Type()

Просмотреть файл

@ -29,7 +29,7 @@ type D interface{ A|B; C }
//!-input
`
//!+print
// !+print
func PrintNormalTerms(pkg *types.Package) error {
D := pkg.Scope().Lookup("D").Type()
terms, err := typeparams.NormalTerms(D)

Просмотреть файл

@ -36,13 +36,13 @@ var ErrEmptyTypeSet = errors.New("empty type set")
// 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,

Просмотреть файл

@ -10,11 +10,10 @@ import "go/types"
// 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

Просмотреть файл

@ -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

Просмотреть файл

@ -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