Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/gorename: gorename fails with on cgo-using files #15793

Open
ashb opened this issue May 22, 2016 · 3 comments
Open

x/tools/cmd/gorename: gorename fails with on cgo-using files #15793

ashb opened this issue May 22, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@ashb
Copy link

@ashb ashb commented May 22, 2016

Please answer these questions before submitting your issue. Thanks!

1. What version of Go are you using (go version)?

go version go1.6 darwin/amd64

2. What operating system and processor architecture are you using (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"

3. What did you do?

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

4. What did you expect to see?

It rename without error: Renamed 2 occurrences in 1 file in 1 package.

5. What did you see instead?

I got this error: gorename: -offset "demo.go:#78": no identifier at this position

@rakyll rakyll changed the title gorename fails with on cgo-using files x/tools/cmd/gorename: gorename fails with on cgo-using files May 22, 2016
@rakyll rakyll added this to the Unreleased milestone May 22, 2016
@rakyll
Copy link
Contributor

@rakyll rakyll commented May 22, 2016

@zer09
Copy link

@zer09 zer09 commented Apr 28, 2017

Having the same issue, is there any workaround on this?

@AlexRouSg
Copy link
Contributor

@AlexRouSg AlexRouSg commented Jan 14, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.