From de2b27dee761143116b2ecb303b67e018c5e7473 Mon Sep 17 00:00:00 2001 From: Prajwal Koirala <16564273+Prajwal-Koirala@users.noreply.github.com> Date: Mon, 15 Mar 2021 06:13:23 +0000 Subject: [PATCH] all: run gofmt Fixes #44980 Change-Id: Icef35319d1582d8367c8911e15d11b0224957327 GitHub-Last-Rev: 2113e97e837c1ef5de9ba6a7bd62db92e644c500 GitHub-Pull-Request: golang/go#45005 Reviewed-on: https://go-review.googlesource.com/c/go/+/301632 Reviewed-by: Ian Lance Taylor Trust: Josh Bleecher Snyder --- misc/cgo/testplugin/testdata/method2/main.go | 2 +- src/cmd/compile/internal/ssa/gen/S390XOps.go | 2 +- src/cmd/cover/testdata/toolexec.go | 2 +- src/cmd/go/testdata/addmod.go | 2 +- .../riscv/testdata/testbranch/branch_test.go | 8 ++-- src/cmd/link/internal/ld/elf.go | 39 +++++++++---------- .../ld/testdata/deadcode/ifacemethod3.go | 2 +- src/runtime/testdata/testwinsignal/main.go | 38 +++++++++--------- 8 files changed, 47 insertions(+), 48 deletions(-) diff --git a/misc/cgo/testplugin/testdata/method2/main.go b/misc/cgo/testplugin/testdata/method2/main.go index 6a87e7b6a0..89afbda3d4 100644 --- a/misc/cgo/testplugin/testdata/method2/main.go +++ b/misc/cgo/testplugin/testdata/method2/main.go @@ -15,7 +15,7 @@ import ( var t p.T -type I interface { M() } +type I interface{ M() } func main() { pl, err := plugin.Open("method2.so") diff --git a/src/cmd/compile/internal/ssa/gen/S390XOps.go b/src/cmd/compile/internal/ssa/gen/S390XOps.go index 1ddad1febd..5b33ba710e 100644 --- a/src/cmd/compile/internal/ssa/gen/S390XOps.go +++ b/src/cmd/compile/internal/ssa/gen/S390XOps.go @@ -381,7 +381,7 @@ func init() { {name: "NOT", argLength: 1, reg: gp11, resultInArg0: true, clobberFlags: true}, // ^arg0 {name: "NOTW", argLength: 1, reg: gp11, resultInArg0: true, clobberFlags: true}, // ^arg0 - {name: "FSQRT", argLength: 1, reg: fp11, asm: "FSQRT"}, // sqrt(arg0) + {name: "FSQRT", argLength: 1, reg: fp11, asm: "FSQRT"}, // sqrt(arg0) {name: "FSQRTS", argLength: 1, reg: fp11, asm: "FSQRTS"}, // sqrt(arg0), float32 // Conditional register-register moves. diff --git a/src/cmd/cover/testdata/toolexec.go b/src/cmd/cover/testdata/toolexec.go index 386de79038..458adaeaaa 100644 --- a/src/cmd/cover/testdata/toolexec.go +++ b/src/cmd/cover/testdata/toolexec.go @@ -15,8 +15,8 @@ package main import ( - "os" exec "internal/execabs" + "os" "strings" ) diff --git a/src/cmd/go/testdata/addmod.go b/src/cmd/go/testdata/addmod.go index 09fc8e713b..03869e68de 100644 --- a/src/cmd/go/testdata/addmod.go +++ b/src/cmd/go/testdata/addmod.go @@ -22,10 +22,10 @@ import ( "bytes" "flag" "fmt" + exec "internal/execabs" "io/fs" "log" "os" - exec "internal/execabs" "path/filepath" "strings" diff --git a/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go b/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go index 3fa95222ff..de412c64a7 100644 --- a/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go +++ b/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go @@ -25,13 +25,13 @@ func testBLTU(a, b int64) (r bool) func testBLTZ(a int64) (r bool) func testBNEZ(a int64) (r bool) -func testGoBGE(a, b int64) bool { return a >= b } +func testGoBGE(a, b int64) bool { return a >= b } func testGoBGEU(a, b int64) bool { return uint64(a) >= uint64(b) } -func testGoBGT(a, b int64) bool { return a > b } +func testGoBGT(a, b int64) bool { return a > b } func testGoBGTU(a, b int64) bool { return uint64(a) > uint64(b) } -func testGoBLE(a, b int64) bool { return a <= b } +func testGoBLE(a, b int64) bool { return a <= b } func testGoBLEU(a, b int64) bool { return uint64(a) <= uint64(b) } -func testGoBLT(a, b int64) bool { return a < b } +func testGoBLT(a, b int64) bool { return a < b } func testGoBLTZ(a, b int64) bool { return uint64(a) < uint64(b) } func TestBranchCondition(t *testing.T) { diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go index d3e598b312..b4af0931cc 100644 --- a/src/cmd/link/internal/ld/elf.go +++ b/src/cmd/link/internal/ld/elf.go @@ -522,22 +522,22 @@ func elfwriteinterp(out *OutBuf) int { // member of .gnu.attributes of MIPS for fpAbi const ( // No floating point is present in the module (default) - MIPS_FPABI_NONE = 0 + MIPS_FPABI_NONE = 0 // FP code in the module uses the FP32 ABI for a 32-bit ABI - MIPS_FPABI_ANY = 1 + MIPS_FPABI_ANY = 1 // FP code in the module only uses single precision ABI - MIPS_FPABI_SINGLE = 2 + MIPS_FPABI_SINGLE = 2 // FP code in the module uses soft-float ABI - MIPS_FPABI_SOFT = 3 + MIPS_FPABI_SOFT = 3 // FP code in the module assumes an FPU with FR=1 and has 12 // callee-saved doubles. Historic, no longer supported. - MIPS_FPABI_HIST = 4 + MIPS_FPABI_HIST = 4 // FP code in the module uses the FPXX ABI - MIPS_FPABI_FPXX = 5 + MIPS_FPABI_FPXX = 5 // FP code in the module uses the FP64 ABI - MIPS_FPABI_FP64 = 6 + MIPS_FPABI_FP64 = 6 // FP code in the module uses the FP64A ABI - MIPS_FPABI_FP64A = 7 + MIPS_FPABI_FP64A = 7 ) func elfMipsAbiFlags(sh *ElfShdr, startva uint64, resoff uint64) int { @@ -585,7 +585,7 @@ func elfWriteMipsAbiFlags(ctxt *Link) int { ctxt.Out.Write8(1) // cpr1Size ctxt.Out.Write8(0) // cpr2Size if objabi.GOMIPS == "softfloat" { - ctxt.Out.Write8(MIPS_FPABI_SOFT) // fpAbi + ctxt.Out.Write8(MIPS_FPABI_SOFT) // fpAbi } else { // Go cannot make sure non odd-number-fpr is used (ie, in load a double from memory). // So, we mark the object is MIPS I style paired float/double register scheme, @@ -594,12 +594,12 @@ func elfWriteMipsAbiFlags(ctxt *Link) int { // Note: MIPS_FPABI_ANY is bad naming: in fact it is MIPS I style FPR usage. // It is not for 'ANY'. // TODO: switch to FPXX after be sure that no odd-number-fpr is used. - ctxt.Out.Write8(MIPS_FPABI_ANY) // fpAbi + ctxt.Out.Write8(MIPS_FPABI_ANY) // fpAbi } - ctxt.Out.Write32(0) // isaExt - ctxt.Out.Write32(0) // ases - ctxt.Out.Write32(0) // flags1 - ctxt.Out.Write32(0) // flags2 + ctxt.Out.Write32(0) // isaExt + ctxt.Out.Write32(0) // ases + ctxt.Out.Write32(0) // flags1 + ctxt.Out.Write32(0) // flags2 return int(sh.Size) } @@ -1538,7 +1538,6 @@ func (ctxt *Link) doelf() { addgonote(ctxt, ".note.go.buildid", ELF_NOTE_GOBUILDID_TAG, []byte(*flagBuildid)) } - //type mipsGnuAttributes struct { // version uint8 // 'A' // length uint32 // 15 including itself @@ -1552,12 +1551,12 @@ func (ctxt *Link) doelf() { gnuattributes := ldr.CreateSymForUpdate(".gnu.attributes", 0) gnuattributes.SetType(sym.SELFROSECT) gnuattributes.SetReachable(true) - gnuattributes.AddUint8('A') // version 'A' - gnuattributes.AddUint32(ctxt.Arch, 15) // length 15 including itself + gnuattributes.AddUint8('A') // version 'A' + gnuattributes.AddUint32(ctxt.Arch, 15) // length 15 including itself gnuattributes.AddBytes([]byte("gnu\x00")) // "gnu\0" - gnuattributes.AddUint8(1) // 1:file, 2: section, 3: symbol, 1 here - gnuattributes.AddUint32(ctxt.Arch, 7) // tag length, including tag, 7 here - gnuattributes.AddUint8(4) // 4 for FP, 8 for MSA + gnuattributes.AddUint8(1) // 1:file, 2: section, 3: symbol, 1 here + gnuattributes.AddUint32(ctxt.Arch, 7) // tag length, including tag, 7 here + gnuattributes.AddUint8(4) // 4 for FP, 8 for MSA if objabi.GOMIPS == "softfloat" { gnuattributes.AddUint8(MIPS_FPABI_SOFT) } else { diff --git a/src/cmd/link/internal/ld/testdata/deadcode/ifacemethod3.go b/src/cmd/link/internal/ld/testdata/deadcode/ifacemethod3.go index 9a8dfbce5f..37c89374cb 100644 --- a/src/cmd/link/internal/ld/testdata/deadcode/ifacemethod3.go +++ b/src/cmd/link/internal/ld/testdata/deadcode/ifacemethod3.go @@ -14,7 +14,7 @@ type S int func (s S) M() { println("S.M") } -type I interface { M() } +type I interface{ M() } type T float64 diff --git a/src/runtime/testdata/testwinsignal/main.go b/src/runtime/testdata/testwinsignal/main.go index d8cd884ffa..1e7c9475fd 100644 --- a/src/runtime/testdata/testwinsignal/main.go +++ b/src/runtime/testdata/testwinsignal/main.go @@ -1,19 +1,19 @@ -package main - -import ( - "fmt" - "os" - "os/signal" - "time" -) - -func main() { - c := make(chan os.Signal, 1) - signal.Notify(c) - - fmt.Println("ready") - sig := <-c - - time.Sleep(time.Second) - fmt.Println(sig) -} +package main + +import ( + "fmt" + "os" + "os/signal" + "time" +) + +func main() { + c := make(chan os.Signal, 1) + signal.Notify(c) + + fmt.Println("ready") + sig := <-c + + time.Sleep(time.Second) + fmt.Println(sig) +} -- 2.48.1