请在提交问题之前回答这些问题。 谢谢!
go version
)?go version go1.6 darwin/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ash/code/go"
GORACE=""
GOROOT="/Users/ash/.homebrew/Cellar/go/1.6/libexec"
GOTOOLDIR="/Users/ash/.homebrew/Cellar/go/1.6/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
鉴于此输入文件demo.go
:
package main
// #include <unistd.h>
import "C"
import "fmt"
func main() {
foo := 1
C.close(2)
fmt.Println(foo)
}
运行此命令: gorename -offset demo.go:#78 -to bar
它重命名没有错误: Renamed 2 occurrences in 1 file in 1 package.
我收到此错误: gorename: -offset "demo.go:#78": no identifier at this position
/cc @alandonovan
遇到同样的问题,请问有解决办法吗?
我不确定何时(我在 1.9.2 上)但错误更改为:“gorename:无法重命名包含请勿编辑标记的生成文件中的标识符”
我花了一段时间才发现 gorename 对 cgo 文件不起作用。 如果短期内没有修复,至少应该更改错误消息。
最有用的评论
遇到同样的问题,请问有解决办法吗?