I'm working on a project and have a couple of packages that I've created which I'm importing in my main project.
Now when I take code and move it into an external package I can call it's functions fine from my main project. But once I add new functions to my external package, I always get an undefined func...
error during the build process.
I've tried rebuilding my external package.. but no luck. The only way I've been able to update the reference to my custom package, has been to rename the external package & folder.
For instance, If I have the following in /project/blah/blah.go:
package blah
func DoSomethingCool(s string) {
fmt.Print(s)
}
I can call this func in my main application (project/web/main.go) as blah.DoSomethingCool("Hello World")
. Now this works as expected. But now if I update package blah to:
package blah
func DoSomethingCool(s string) {
fmt.Print(s)
}
func DoSomethingElseEvenCooler(p string, q string) {
fmt.Print(
fmt.Sprint(p, q),
)
}
I cannot call blah.DoSomethingElseEvenCooler("p", "q") even with a rebuild of blah. I end up with a func undefined error.
However if I rename blah to foo and rename the path to /project/foo/foo.go, I can call foo.DoSomethingElseEvenCooler("p", "q") perfectly fine. Seems like the reference to package blah is not being updated even though it has changed. Is there a way to force this while I'm building my main project?
Or am I just missing something?