зеркало из https://github.com/golang/tools.git
x/tools: simplify and format code
Semi-mechanical changes using gofmt -s and honnef.co/go/tools/cmd/gosimple. Change-Id: I41bcf4bea5b16c4776b7cf6534b76aa59b3c022d Reviewed-on: https://go-review.googlesource.com/37447 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Родитель
4968197297
Коммит
718875e4f9
|
@ -175,7 +175,7 @@ func doCallgraph(ctxt *build.Context, algo, format string, tests bool, args []st
|
|||
}
|
||||
|
||||
// Use the initial packages from the command line.
|
||||
args, err := conf.FromArgs(args, tests)
|
||||
_, err := conf.FromArgs(args, tests)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -4,17 +4,20 @@
|
|||
|
||||
package alias // @describe describe-pkg "alias"
|
||||
|
||||
type I interface{ f() } // @implements implements-I "I"
|
||||
type I interface { // @implements implements-I "I"
|
||||
f()
|
||||
}
|
||||
|
||||
type N int
|
||||
|
||||
func (N) f() {}
|
||||
|
||||
type M = N // @describe describe-def-M "M"
|
||||
var m M // @describe describe-ref-M "M"
|
||||
var m M // @describe describe-ref-M "M"
|
||||
|
||||
type O N // @describe describe-O "O"
|
||||
|
||||
type P = struct{N} // @describe describe-P "N"
|
||||
type P = struct{ N } // @describe describe-P "N"
|
||||
|
||||
type U = undefined // @describe describe-U "U"
|
||||
type _ = undefined // @describe describe-undefined "undefined"
|
||||
|
|
|
@ -35,7 +35,7 @@ func main() {
|
|||
case chA2 <- &a2: // @peers peer-send-chA' "<-"
|
||||
}
|
||||
|
||||
for _ = range chA {
|
||||
for range chA {
|
||||
}
|
||||
|
||||
close(chA) // @peers peer-close-chA "chA"
|
||||
|
|
|
@ -88,11 +88,7 @@ func initTemplates(base string) error {
|
|||
|
||||
var err error
|
||||
dirListTemplate, err = template.ParseFiles(filepath.Join(base, "templates/dir.tmpl"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
// renderDoc reads the present file, gets its template representation,
|
||||
|
|
|
@ -294,7 +294,7 @@ func compareTool() {
|
|||
}
|
||||
|
||||
cmdS := append([]string{cmd[0], extra}, cmd[1:]...)
|
||||
outfile, ok = cmpRun(true, cmdS)
|
||||
outfile, _ = cmpRun(true, cmdS)
|
||||
|
||||
fmt.Fprintf(os.Stderr, "\n%s\n", compareLogs(outfile))
|
||||
os.Exit(2)
|
||||
|
|
|
@ -770,7 +770,7 @@ func (p *exporter) rawByte(b byte) {
|
|||
// tracef is like fmt.Printf but it rewrites the format string
|
||||
// to take care of indentation.
|
||||
func (p *exporter) tracef(format string, args ...interface{}) {
|
||||
if strings.IndexAny(format, "<>\n") >= 0 {
|
||||
if strings.ContainsAny(format, "<>\n") {
|
||||
var buf bytes.Buffer
|
||||
for i := 0; i < len(format); i++ {
|
||||
// no need to deal with runes
|
||||
|
|
|
@ -435,7 +435,7 @@ func init() {
|
|||
func init() {
|
||||
// Regression test for SSA renaming bug.
|
||||
var ints []int
|
||||
for _ = range "foo" {
|
||||
for range "foo" {
|
||||
var x int
|
||||
x++
|
||||
ints = append(ints, x)
|
||||
|
|
|
@ -182,7 +182,7 @@ func filterInfo(args []string, info *PageInfo) {
|
|||
|
||||
// Does s look like a regular expression?
|
||||
func isRegexp(s string) bool {
|
||||
return strings.IndexAny(s, ".(|)*+?^$[]") >= 0
|
||||
return strings.ContainsAny(s, ".(|)*+?^$[]")
|
||||
}
|
||||
|
||||
// Make a regular expression of the form
|
||||
|
|
|
@ -38,7 +38,7 @@ func Style(s string) template.HTML {
|
|||
|
||||
// font returns s with font indicators turned into HTML font tags.
|
||||
func font(s string) string {
|
||||
if strings.IndexAny(s, "[`_*") == -1 {
|
||||
if !strings.ContainsAny(s, "[`_*") {
|
||||
return s
|
||||
}
|
||||
words := split(s)
|
||||
|
|
Загрузка…
Ссылка в новой задаче