-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
go/types: conf.check complains about a function is not declared in a package #19334
Comments
ps: one work around is uncomment those lines and rename the package reference to "animall" instead of "animal" it would work. BUT I really don't want to rename my package every time when I add a new function in the package. |
Show us how you get the error. Show us the precise files you use. Show us the complete code you use to call the go/types package, with I ask this because as far as I can tell everything should work. Experience tells me that you are doing something that I do not expect. If you show us precisely what you are doing, we can figure out what that is. Thanks. |
main.go
The error occurs when I try to implement a new function in package animal and try to use it in hello.go after I resolve types for the first time. now
in hello.go
now go run main.go ps: hello.go and animal.go has provided in the issue description. main.go and hello.go are in the same folder. animal.go is in a subdirectory called animal. I guess it keeps a record of the ast file of the dependency in the first run. After I modify the dependency it still tries to read the old ast file for types, thus it complains about there is not such "modified/new" function in the dependency/package. |
Where does the file animal.go live? Did you ever run |
As @ianlancetaylor is hinting at, I suspect you did not re-install the updated package As of a couple of days, instead of |
@ianlancetaylor Thanks for your reply. I was a bit confused about your last sentence. Are you suggesting I should use the latest std library with my current go version(1.7.4) It seems the functionality you described only exist in 1.8 and yet it does not work in 1.8 |
@jzhu077 I believe you meant to address me with your recent comment. I was suggesting that you could use the latest std library at tip (not yet released, requires installation from source), which is where the new functionality exists. It does not work in 1.8 (which is the latest released library). That said, if this sentence confused you, feel free to ignore it. Again, I believe your error is that you changed the package |
@griesemer haha you are right. Cheers |
I am going to close this as working as intended. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.4 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
hello.go
animal.go
What did you expect to see? ### What did you see instead?
It runs perfectly without those commented lines, however when I uncomment them. The config.check gives an error
I have tested it with
after uncomment those lines. It does what it suppose to do.
The text was updated successfully, but these errors were encountered: