1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:00:06 -07:00

all: gofmt main repo

Excluding vendor and testdata.
CL 384268 already reformatted most, but these slipped past.

The struct in the doc comment in debug/dwarf/type.go
was fixed up by hand to indent the first and last lines as well.

For #51082.

Change-Id: Iad020f83aafd671ff58238fe491907e85923d0c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/407137
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Russ Cox 2022-05-18 16:46:20 -04:00 committed by Gopher Robot
parent e23cc0844d
commit 946b4baaf6
22 changed files with 66 additions and 61 deletions

View File

@ -57,7 +57,7 @@ type File struct {
zip *Reader
zipr io.ReaderAt
headerOffset int64 // includes overall ZIP archive baseOffset
zip64 bool // zip64 extended information extra field presence
zip64 bool // zip64 extended information extra field presence
}
// OpenReader will open the Zip file specified by name and return a ReadCloser.

View File

@ -264,11 +264,13 @@ func NewIfStmt(pos src.XPos, cond Node, body, els []Node) *IfStmt {
}
// A JumpTableStmt is used to implement switches. Its semantics are:
// tmp := jt.Idx
// if tmp == Cases[0] goto Targets[0]
// if tmp == Cases[1] goto Targets[1]
// ...
// if tmp == Cases[n] goto Targets[n]
//
// tmp := jt.Idx
// if tmp == Cases[0] goto Targets[0]
// if tmp == Cases[1] goto Targets[1]
// ...
// if tmp == Cases[n] goto Targets[n]
//
// Note that a JumpTableStmt is more like a multiway-goto than
// a multiway-if. In particular, the case bodies are just
// labels to jump to, not not full Nodes lists.

View File

@ -420,9 +420,9 @@ func (conf *Config) Check(path string, files []*syntax.File, info *Info) (*Packa
// AssertableTo reports whether a value of type V can be asserted to have type T.
//
// The behavior of AssertableTo is undefined in two cases:
// - if V is a generalized interface; i.e., an interface that may only be used
// as a type constraint in Go code
// - if T is an uninstantiated generic type
// - if V is a generalized interface; i.e., an interface that may only be used
// as a type constraint in Go code
// - if T is an uninstantiated generic type
func AssertableTo(V *Interface, T Type) bool {
// Checker.newAssertableTo suppresses errors for invalid types, so we need special
// handling here.

View File

@ -10,7 +10,7 @@
//
// For detailed usage information:
//
// go tool pprof -h
// go tool pprof -h
//
// For an example, see https://blog.golang.org/profiling-go-programs.
package main

View File

@ -43,6 +43,7 @@ func (b *aesCipherAsm) NewCBCDecrypter(iv []byte) cipher.BlockMode {
func (x *cbc) BlockSize() int { return BlockSize }
// cryptBlocksChain invokes the cipher message identifying encrypt or decrypt.
//
//go:noescape
func cryptBlocksChain(src, dst *byte, length int, key *uint32, iv *byte, enc int, nr int)

View File

@ -155,7 +155,7 @@ type StructType struct {
// A StructField represents a field in a struct, union, or C++ class type.
//
// Bit Fields
// # Bit Fields
//
// The BitSize, BitOffset, and DataBitOffset fields describe the bit
// size and offset of data members declared as bit fields in C/C++
@ -185,24 +185,24 @@ type StructType struct {
// Here is an example of C/C++ bit field use, along with what to
// expect in terms of DWARF bit offset info. Consider this code:
//
// struct S {
// int q;
// int j:5;
// int k:6;
// int m:5;
// int n:8;
// } s;
// struct S {
// int q;
// int j:5;
// int k:6;
// int m:5;
// int n:8;
// } s;
//
// For the code above, one would expect to see the following for
// DW_AT_bit_offset values (using GCC 8):
//
// Little | Big
// Endian | Endian
// |
// "j": 27 | 0
// "k": 21 | 5
// "m": 16 | 11
// "n": 8 | 16
// Little | Big
// Endian | Endian
// |
// "j": 27 | 0
// "k": 21 | 5
// "m": 16 | 11
// "n": 8 | 16
//
// Note that in the above the offsets are purely with respect to the
// containing storage unit for j/k/m/n -- these values won't vary based
@ -211,10 +211,10 @@ type StructType struct {
// If the compiler emits DW_AT_data_bit_offset, the expected values
// would be:
//
// "j": 32
// "k": 37
// "m": 43
// "n": 48
// "j": 32
// "k": 37
// "m": 43
// "n": 48
//
// Here the value 32 for "j" reflects the fact that the bit field is
// preceded by other data members (recall that DW_AT_data_bit_offset
@ -226,7 +226,6 @@ type StructType struct {
// non-zero bit size and bit offset, so this information is also
// captured for base types, but it is worth noting that it is not
// possible to trigger this behavior using mainstream languages.
//
type StructField struct {
Name string
Type Type

View File

@ -329,7 +329,6 @@ var bitfieldTests = map[string]string{
// another_struct {quix short unsigned int@0; xyz [-1]int@4; x unsigned int@4 : 1@31; array [40]long long int@8}
//
// Note the "-1" for the xyz field, which should be zero.
//
func TestBitFieldZeroArrayIssue50685(t *testing.T) {
f := "testdata/bitfields.elf4"
testTypedefs(t, elfData(t, f), "elf", bitfieldTests)

View File

@ -30,19 +30,19 @@ type COFFSymbol struct {
// symbols for a given primary symbol are placed following it in the
// array, e.g.
//
// ...
// k+0: regular sym k
// k+1: 1st aux symbol for k
// k+2: 2nd aux symbol for k
// k+3: regular sym k+3
// k+4: 1st aux symbol for k+3
// k+5: regular sym k+5
// k+6: regular sym k+6
// ...
// k+0: regular sym k
// k+1: 1st aux symbol for k
// k+2: 2nd aux symbol for k
// k+3: regular sym k+3
// k+4: 1st aux symbol for k+3
// k+5: regular sym k+5
// k+6: regular sym k+6
//
// The PE format allows for several possible aux symbol formats. For
// more info see:
//
// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-symbol-records
// https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#auxiliary-symbol-records
//
// At the moment this package only provides APIs for looking at
// aux symbols of format 5 (associated with section definition symbols).

View File

@ -40,7 +40,6 @@ func readGopackHeader(r *bufio.Reader) (name string, size int, err error) {
// file by reading from it. The reader must be positioned at the
// start of the file before calling this function. The hdr result
// is the string before the export data, either "$$" or "$$B".
//
func FindExportData(r *bufio.Reader) (hdr string, size int, err error) {
// Read first line to make sure this is an object file.
line, err := r.ReadSlice('\n')

View File

@ -43,7 +43,6 @@ type pair struct{ x, y int }
// Second, the name is frequently interpreted as meaning that you have
// to wait longer (to be patient) for the diff, meaning that it is a slower algorithm,
// when in fact the algorithm is faster than the standard one.
//
func Diff(oldName string, old []byte, newName string, new []byte) []byte {
if bytes.Equal(old, new) {
return nil

View File

@ -42,7 +42,7 @@ func (mr *multiReader) Read(p []byte) (n int, err error) {
}
func (mr *multiReader) WriteTo(w Writer) (sum int64, err error) {
return mr.writeToWithBuffer(w, make([]byte, 1024 * 32))
return mr.writeToWithBuffer(w, make([]byte, 1024*32))
}
func (mr *multiReader) writeToWithBuffer(w Writer, buf []byte) (sum int64, err error) {

View File

@ -93,7 +93,7 @@ func (smallUint) Generate(rand *rand.Rand, size int) reflect.Value {
// f is a function that takes x as an argument, doesn't modify it, sets v to the
// result, and returns v. It is the function signature of unbound methods like
//
// func (v *big.Int) m(x *big.Int) *big.Int
// func (v *big.Int) m(x *big.Int) *big.Int
//
// v and x are two random Int values. v is randomized even if it will be
// overwritten to test for improper buffer reuse.
@ -122,7 +122,7 @@ func checkAliasingOneArg(t *testing.T, f func(v, x *big.Int) *big.Int, v, x *big
// to the result, and returns v. It is the function signature of unbound methods
// like
//
// func (v *big.Int) m(x, y *big.Int) *big.Int
// func (v *big.Int) m(x, y *big.Int) *big.Int
//
// v, x and y are random Int values. v is randomized even if it will be
// overwritten to test for improper buffer reuse.

View File

@ -588,7 +588,9 @@ func (e InvalidAddrError) Temporary() bool { return false }
//
// TODO(iant): We could consider changing this to os.ErrDeadlineExceeded
// in the future, if we make
// errors.Is(os.ErrDeadlineExceeded, context.DeadlineExceeded)
//
// errors.Is(os.ErrDeadlineExceeded, context.DeadlineExceeded)
//
// return true.
var errTimeout error = &timeoutError{}

View File

@ -188,7 +188,6 @@ func SetTraceback(level string)
// aggressively. This limit will be respected even if GOGC=off (or,
// if SetGCPercent(-1) is executed).
//
//
// The input limit is provided as bytes, and includes all memory
// mapped, managed, and not released by the Go runtime. Notably, it
// does not account for space used by the Go binary and memory
@ -202,11 +201,11 @@ func SetTraceback(level string)
// More specifically, the following expression accurately reflects
// the value the runtime attempts to maintain as the limit:
//
// runtime.MemStats.Sys - runtime.MemStats.HeapReleased
// runtime.MemStats.Sys - runtime.MemStats.HeapReleased
//
// or in terms of the runtime/metrics package:
//
// /memory/classes/total:bytes - /memory/classes/heap/released:bytes
// /memory/classes/total:bytes - /memory/classes/heap/released:bytes
//
// A zero limit or a limit that's lower than the amount of memory
// used by the Go runtime may cause the garbage collector to run

View File

@ -44,6 +44,7 @@ import "unsafe"
//
// Don't split the stack as this function may be invoked without a valid G,
// which prevents us from allocating more stack.
//
//go:nosplit
func sysAlloc(n uintptr, sysStat *sysMemStat) unsafe.Pointer {
sysStat.add(int64(n))
@ -94,6 +95,7 @@ func sysHugePage(v unsafe.Pointer, n uintptr) {
//
// Don't split the stack as this function may be invoked without a valid G,
// which prevents us from allocating more stack.
//
//go:nosplit
func sysFree(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
sysStat.add(-int64(n))

View File

@ -1456,6 +1456,7 @@ func (c *piController) reset() {
// If this returns false, the caller must NOT become an idle mark worker.
//
// nosplit because it may be called without a P.
//
//go:nosplit
func (c *gcControllerState) addIdleMarkWorker() bool {
for {
@ -1483,6 +1484,7 @@ func (c *gcControllerState) addIdleMarkWorker() bool {
// useful for a quick check before an expensive operation.
//
// nosplit because it may be called without a P.
//
//go:nosplit
func (c *gcControllerState) needIdleMarkWorker() bool {
p := c.idleMarkWorkers.Load()

View File

@ -864,6 +864,7 @@ func syscall_runtime_doAllThreadsSyscall(trap, a1, a2, a3, a4, a5, a6 uintptr) (
//
// This function throws if the system call returns with anything other than the
// expected values.
//
//go:nosplit
func runPerThreadSyscall() {
gp := getg()

View File

@ -425,7 +425,7 @@ func atoi32(s string) (int32, bool) {
//
// s must match the following regular expression:
//
// ^[0-9]+(([KMGT]i)?B)?$
// ^[0-9]+(([KMGT]i)?B)?$
//
// In other words, an integer byte count with an optional unit
// suffix. Acceptable suffixes include one of

View File

@ -3,8 +3,7 @@
// license that can be found in the LICENSE file.
//go:build linux && s390x
// +build linux
// +build s390x
// +build linux,s390x
package runtime

View File

@ -87,14 +87,15 @@ func Search(n int, f func(int) bool) int {
//
// For example, to look for a particular string in a sorted, random-access
// list of strings:
// i, found := sort.Find(x.Len(), func(i int) int {
// return strings.Compare(target, x.At(i))
// })
// if found {
// fmt.Printf("found %s at entry %d\n", target, i)
// } else {
// fmt.Printf("%s not found, would insert at %d", target, i)
// }
//
// i, found := sort.Find(x.Len(), func(i int) int {
// return strings.Compare(target, x.At(i))
// })
// if found {
// fmt.Printf("found %s at entry %d\n", target, i)
// } else {
// fmt.Printf("%s not found, would insert at %d", target, i)
// }
func Find(n int, cmp func(int) int) (i int, found bool) {
// The invariants here are similar to the ones in Search.
// Define cmp(-1) > 0 and cmp(n) <= 0

View File

@ -36,7 +36,6 @@
// The load and store operations, implemented by the LoadT and StoreT
// functions, are the atomic equivalents of "return *addr" and
// "*addr = val".
//
package atomic
import (

View File

@ -32,6 +32,7 @@ func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errn
//go:linkname runtime_entersyscall runtime.entersyscall
func runtime_entersyscall()
//go:linkname runtime_exitsyscall runtime.exitsyscall
func runtime_exitsyscall()