mirror of
https://github.com/golang/go
synced 2024-11-19 00:04:40 -07:00
f80f67146e
Support the renaming of the imported name of a package within a file. This case needs to be special cased because the ident may be added or removed. Change-Id: I333bc2b2ca5ce81c4a2afb8b10035f525dfad464 Reviewed-on: https://go-review.googlesource.com/c/tools/+/184199 Run-TryBot: Suzy Mueller <suzmue@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
43 lines
650 B
Go
43 lines
650 B
Go
package a
|
|
|
|
import (
|
|
lg "log"
|
|
"fmt"
|
|
f2 "fmt"
|
|
)
|
|
|
|
func Random() int {
|
|
y := 6 + 7
|
|
return y
|
|
}
|
|
|
|
func Random2(y int) int { //@rename("y", "z")
|
|
return y
|
|
}
|
|
|
|
type Pos struct {
|
|
x, y int
|
|
}
|
|
|
|
func (p *Pos) Sum() int {
|
|
return p.x + p.y //@rename("x", "myX")
|
|
}
|
|
|
|
func _() {
|
|
var p Pos //@rename("p", "pos")
|
|
_ = p.Sum() //@rename("Sum", "GetSum")
|
|
}
|
|
|
|
func sw() {
|
|
var x interface{}
|
|
|
|
switch y := x.(type) { //@rename("y", "y0")
|
|
case int:
|
|
fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
|
|
case string:
|
|
lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
|
|
default:
|
|
f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
|
|
}
|
|
}
|