1
0
mirror of https://github.com/golang/go synced 2024-11-19 09:54:49 -07:00
go/internal/lsp/testdata/rename/a/random.go.in
Suzy Mueller c4a336ef6a internal/lsp: support renaming of import spec
This change allows renamings of the name of an import spec.
Since there is not always explicit identifier available to select and
rename, allow renaming packages from positions within the import spec.

Change-Id: I0a8aaa92c26e1795ddb9c31a1165b2f2ee89aa34
Reviewed-on: https://go-review.googlesource.com/c/tools/+/191165
Run-TryBot: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-08-23 17:09:09 +00:00

43 lines
721 B
Go

package a
import (
lg "log"
"fmt" //@rename("fmt", "fmty")
f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
)
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")
}
}