Skip to content

Commit

Permalink
cmd/{go,compile}: run gofmt
Browse files Browse the repository at this point in the history
Ran gofmt on a couple of Go source files that needed it.

Change-Id: I0e9f78831f531a728b892a63c6e0c517d92b11a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/507156
Run-TryBot: Than McIntosh <[email protected]>
Reviewed-by: Austin Clements <[email protected]>
Reviewed-by: Cuong Manh Le <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
  • Loading branch information
thanm committed Jun 29, 2023
1 parent da5d8fd commit fe73c18
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/cmd/compile/internal/devirtualize/devirtualize.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

// Package devirtualize implements two "devirtualization" optimization passes:
//
// - "Static" devirtualization which replaces interface method calls with
// direct concrete-type method calls where possible.
// - "Profile-guided" devirtualization which replaces indirect calls with a
// conditional direct call to the hottest concrete callee from a profile, as
// well as a fallback using the original indirect call.
// - "Static" devirtualization which replaces interface method calls with
// direct concrete-type method calls where possible.
// - "Profile-guided" devirtualization which replaces indirect calls with a
// conditional direct call to the hottest concrete callee from a profile, as
// well as a fallback using the original indirect call.
package devirtualize

import (
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/typecheck/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ func tcSwitchType(n *ir.SwitchStmt) {
if !n1.Type().IsInterface() {
why := ImplementsExplain(n1.Type(), t)
if why != "" {
base.ErrorfAt(ncase.Pos(), errors.ImpossibleAssert, "impossible type switch case: %L cannot have dynamic type %v (%s)" , guard.X, n1.Type(), why)
base.ErrorfAt(ncase.Pos(), errors.ImpossibleAssert, "impossible type switch case: %L cannot have dynamic type %v (%s)", guard.X, n1.Type(), why)
}
continue
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/typecheck/subr.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,12 +713,12 @@ func ImplementsExplain(t, iface *types.Type) string {
return fmt.Sprintf("%v does not implement %v (%v method is marked 'nointerface')", t, iface, missing.Sym)
} else if have != nil && have.Sym == missing.Sym {
return fmt.Sprintf("%v does not implement %v (wrong type for %v method)\n"+
"\t\thave %v%S\n\t\twant %v%S", t, iface, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
"\t\thave %v%S\n\t\twant %v%S", t, iface, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else if ptr != 0 {
return fmt.Sprintf("%v does not implement %v (%v method has pointer receiver)", t, iface, missing.Sym)
} else if have != nil {
return fmt.Sprintf("%v does not implement %v (missing %v method)\n"+
"\t\thave %v%S\n\t\twant %v%S", t, iface, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
"\t\thave %v%S\n\t\twant %v%S", t, iface, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
}
return fmt.Sprintf("%v does not implement %v (missing %v method)", t, iface, missing.Sym)
}
Expand Down
1 change: 0 additions & 1 deletion src/cmd/go/internal/gover/gover.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func IsPrerelease(x string) bool {
//
// Prev("1.2") = "1.1"
// Prev("1.3rc4") = "1.2"
//
func Prev(x string) string {
v := parse(x)
if cmpInt(v.minor, "1") <= 0 {
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ func maybeStartTrace(pctx context.Context) context.Context {
//
// We have to handle the -C flag this way for two reasons:
//
// 1. Toolchain selection needs to be in the right directory to look for go.mod and go.work.
// 1. Toolchain selection needs to be in the right directory to look for go.mod and go.work.
//
// 2. A toolchain switch later on reinvokes the new go command with the same arguments.
// The parent toolchain has already done the chdir; the child must not try to do it again.
// 2. A toolchain switch later on reinvokes the new go command with the same arguments.
// The parent toolchain has already done the chdir; the child must not try to do it again.
func handleChdirFlag() {
_, used := lookupCmd(os.Args[1:])
used++ // because of [1:]
Expand Down

0 comments on commit fe73c18

Please sign in to comment.