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: cannot find Swig identifiers #23261

Open
fabrice102 opened this issue Dec 27, 2017 · 1 comment

Comments

@fabrice102
Copy link

commented Dec 27, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.2 darwin/amd64

Does this issue reproduce with the latest release?

I am using the latest version

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/fbenhamo/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pp/87h481t95tl4rrv9kygw9z7r0000gn/T/go-build287490315=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

In the folder $GOPATH/src/test, I created the following files:

--- main.cxx
#include <iostream>

void SwigTest(int a) {
    std::cout << a << std::endl;
}

--- main.hpp
void SwigTest(int a);

--- main.swigcxx
%{
#include "main.hpp"
%}

%include "main.hpp"

--- test.go
package main

var val = 42

// Test just call the swig function SwigTest
func main() {
	SwigTest(val)
}

and I ran:

gorename -from test.go::val -to value

What did you expect to see?

I expected val to be renamed into value.
(And this actually works if I comment the line SwigTest(val) of test.go).

What did you see instead?

/Users/fbenhamo/go/src/test/test.go:7:2: undeclared name: SwigTest
gorename: couldn't load packages due to errors: test

Note: the previous example compiles (go build) and run perfectly well. Only gorename cannot find the symbol SwigTest declared by swig.

@gopherbot gopherbot added this to the Unreleased milestone Dec 27, 2017

@fabrice102

This comment has been minimized.

Copy link
Author

commented Dec 27, 2017

It might be related to #15793.

@gopherbot gopherbot added the Tools label Sep 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.