Skip to content

Commit

Permalink
all: fmt tests with new gofmt
Browse files Browse the repository at this point in the history
Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

The Go 1.17 gofmt will insert the extra //go:build lines.
The older gofmts will not remove them.
Get ahead of the game by adding them now.
(Keeps x/tools tests passing on go repo trybots.)

Change-Id: Ifdb4af93f6cc38a9aa616516e923384b7312e991
Reviewed-on: https://go-review.googlesource.com/c/tools/+/294413
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
  • Loading branch information
rsc committed Feb 20, 2021
1 parent f6e0443 commit b369640
Show file tree
Hide file tree
Showing 32 changed files with 9 additions and 55 deletions.
1 change: 1 addition & 0 deletions cmd/bundle/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ func bundle(src, dst, dstpkg, prefix, buildTags string) ([]byte, error) {

var out bytes.Buffer
if buildTags != "" {
fmt.Fprintf(&out, "//go:build %s\n", buildTags)
fmt.Fprintf(&out, "// +build %s\n\n", buildTags)
}

Expand Down
1 change: 1 addition & 0 deletions cmd/bundle/testdata/out.golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build tag
// +build tag

// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.
Expand Down
1 change: 1 addition & 0 deletions internal/lsp/command/command_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/lsp/command/gen/gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions internal/lsp/command/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

package main
Expand All @@ -11,11 +12,11 @@ import (
"io/ioutil"
"os"

"golang.org/x/tools/internal/lsp/command/generate"
"golang.org/x/tools/internal/lsp/command/gen"
)

func main() {
content, err := generate.Generate()
content, err := gen.Generate()
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/A.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package template

// Basic test of type-aware expression refactoring.
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/A1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package A1

import (
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/A1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package A1

import (
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/A2.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package A2

// This refactoring causes addition of "errors" import.
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/A2.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package A2

// This refactoring causes addition of "errors" import.
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/B1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package B1

import "time"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/B1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package B1

import "time"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/C1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package C1

import "strings"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/C1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package C1

import "strings"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/D1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package D1

import "fmt"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/D1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package D1

import "fmt"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/E1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package E1

import "log"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/E1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package E1

import (
Expand Down
4 changes: 2 additions & 2 deletions refactor/eg/testdata/F.template
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package templates

// Test
// Test

import "sync"

func before(s sync.RWMutex) { s.Lock() }
func after(s sync.RWMutex) { s.RLock() }
func after(s sync.RWMutex) { s.RLock() }
2 changes: 0 additions & 2 deletions refactor/eg/testdata/F1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package F1

import "sync"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/F1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package F1

import "sync"
Expand Down
1 change: 0 additions & 1 deletion refactor/eg/testdata/G.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ import (

func before(from, to token.Pos) ast.BadExpr { return ast.BadExpr{From: from, To: to} }
func after(from, to token.Pos) ast.BadExpr { return ast.BadExpr{from, to} }

2 changes: 0 additions & 2 deletions refactor/eg/testdata/G1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package G1

import "go/ast"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/G1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package G1

import "go/ast"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/H1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package H1

import "go/ast"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/H1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package H1

import "go/ast"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/I.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package templates

import (
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/I1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package I1

import "fmt"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/I1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package I1

import (
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/J.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package templates

import ()
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/J1.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package I1

import "fmt"
Expand Down
2 changes: 0 additions & 2 deletions refactor/eg/testdata/J1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build ignore

package I1

import "fmt"
Expand Down

0 comments on commit b369640

Please sign in to comment.