Please answer these questions before submitting your issue. Thanks!
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"
Given this input file demo.go
:
package main
// #include <unistd.h>
import "C"
import "fmt"
func main() {
foo := 1
C.close(2)
fmt.Println(foo)
}
Run this command: gorename -offset demo.go:#78 -to bar
It rename without error: Renamed 2 occurrences in 1 file in 1 package.
I got this error: gorename: -offset "demo.go:#78": no identifier at this position
/cc @alandonovan
Having the same issue, is there any workaround on this?
I'm not sure when (I'm on go 1.9.2) but the error changed to: "gorename: cannot rename identifiers in generated file containing DO NOT EDIT marker"
And took me a while to figure out that gorename doesn't work on cgo files. Should at least change the error message if there isn't going to be a fix anytime soon.
Most helpful comment
Having the same issue, is there any workaround on this?