]> Cypherpunks repositories - gostls13.git/commitdiff
all: gofmt main repo
authorRuss Cox <rsc@golang.org>
Wed, 18 May 2022 20:46:20 +0000 (16:46 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 19 May 2022 15:49:05 +0000 (15:49 +0000)
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>
22 files changed:
src/archive/zip/reader.go
src/cmd/compile/internal/ir/stmt.go
src/cmd/compile/internal/types2/api.go
src/cmd/pprof/doc.go
src/crypto/aes/cbc_ppc64x.go
src/debug/dwarf/type.go
src/debug/dwarf/type_test.go
src/debug/pe/symbol.go
src/go/internal/gcimporter/exportdata.go
src/internal/diff/diff.go
src/io/multi.go
src/math/big/alias_test.go
src/net/net.go
src/runtime/debug/garbage.go
src/runtime/mem.go
src/runtime/mgcpacer.go
src/runtime/os_linux.go
src/runtime/string.go
src/runtime/vdso_linux_s390x.go
src/sort/search.go
src/sync/atomic/doc.go
src/syscall/syscall_linux.go

index 906f3d308af4bf4b760930231edd17313bf196e5..da6d869db43e374f185673ccc305797048e99308 100644 (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.
index 0e76f174408b36a406c5c328b604d9883989984e..c46debce36b898583ccd9ec3276fc01ef9af1fb4 100644 (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.
index 54cddaee28d0acf0cc195f4f7d27f3ebc774e421..a739b1114dc292613423bb9f727f8867e828b44f 100644 (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.
index 6b8c28fe1d3db94e726fa199bad72c6f9e906437..59e1a47cd19ff2d1552bc63d8322e3ec61c58306 100644 (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
index 4c9257cdd20797ec47cbc68fb10c0aa227625933..797023e9ec3d75a75ecbea0737176dbe91fc352f 100644 (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)
 
index 2049f46d708ddea856990eab1e4ef3c90bcbcf6c..a95c4c738f92cdfa2a62f56478d494d04fc9a090 100644 (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
index 0acc606df7ff8f872543a0ed8bb1253502332ee3..5858ef5d2455dd42732b166e02dd09e15f0f6a3e 100644 (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)
index dfbeb114144dcd8afdf2a6c88df32e9f28fd8eb0..86a1fbc301e9bafa30306fa3a33a24f50e4a06c1 100644 (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).
index 42e6ea9077126587514771b3f70d3b1b5a5bab79..4aa22d7c923969877ffd7b0af91795725a6636d5 100644 (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')
index e2c9e4dc65fb130af5bcfdec4ac45e68ae3856f3..47b285671454ed9ace89cb7b24568abc47c48243 100644 (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
index 909b7e45233a91adfb6f1576458298851d2596c3..07a9afffda38272d264a47af01afb37b827236c7 100644 (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) {
index c0b947cb780bb736ca69b1bf11e8b03c77d99b26..36c37fb0656e1d5aca0306c01e39490e71f57ed4 100644 (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.
index 7a97b9dcfd2a659f111169e2e32a7ef109f224a0..759d5d8aa937a96613b9d4c8ca1093ca0ef79ed7 100644 (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{}
 
index 73dd61b83ec36bf3c938f569fa9c7a0017d4f4dc..0f53928fe8530f6a6c581f1a8cf0628c3a292d46 100644 (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
index 5fdc479f9c1e430cf7c3fe58b747e8b6d99b27d1..0ca933b25b61742b4c49400b0acdb3bfb7a2aba5 100644 (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))
index c275c7dbc4664b6c7144bb4c90e60ae215d93b1c..2487f58dc55009b8e10ddf62ed5c5d1e0a515223 100644 (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()
index 154f27c961b04da1a772acbcda2fe755d1312840..25aea6522dc5fc2f64a892bf85463843a361253d 100644 (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()
index 845dcb50c49a2b354fc6369253117cf89fb15072..5ab0ac3a86a696319ceb7cdbadc03794ce1e9c79 100644 (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
index 85f78bbef227a236bba45fc9364f06fc045f3286..c1c0b1baa47c7ddab6d667e338d1340b74266384 100644 (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
 
index 434349416eebcffad38a09bd3341d5e2b3b3e481..874e40813d1229622bdd57e387eece23c02d9944 100644 (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
index 805ef956d55c5095f27343f63b414601d68dd577..a7d5b46288ac36fbbdce8cbe210101150f7fee4a 100644 (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 (
index ab634a2cbe93adb6f712c082750725fb0cda4253..e1837b91a7b73c2c92993a84e06cf27df3fd49e8 100644 (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()