Please read [1]. From that, it follows, that you should always use
`go install` in your golang/src/myapp directory, and have the libraries
it depends on be automatically re-built and re-installed, if needed.
To be honest, I'm not sure why "-i" of `go build` even exists.
I'd expect it to make `go build` behave like `go install` but it seems
to not be the case.
On Monday, December 29, 2014 12:46:13 PM UTC-6, Konstantin Khomoutov wrote:
Please read [1]. From that, it follows, that you should always use
`go install` in your golang/src/myapp directory, and have the libraries
it depends on be automatically re-built and re-installed, if needed.
Thanks for the reply.
I just tried this using 'go install' for myapp. It also did not pick up any changes
to the mylib/file1.go and rebuild the mylib.a library.
It seems it is definitely necessary to go into the mylib directory, and run 'go install'
there first, and afterwards run 'go install' in the myapp directory to build the application.
I can't guarantee that I didn't imagine this, but IIRC the go tool does not re-build outdated packages accross GOPATH directories. For the life of me, I can't seem to find any documentation or issues discussing it.
I can't guarantee that I didn't imagine this, but IIRC the go tool does not re-build outdated packages accross GOPATH directories. For the life of me, I can't seem to find any documentation or issues discussing it.
I didn't see any mention of it in the official documentation either. This behavior caught us by surprise.
Yes, `go install` is not recursive. It will install dependencies if they are not already there, but it doesn't check them.
Because the go command can analyze the dependency graph, "go install" also installs any packages that this package imports but that are out of date, recursively.
I can't guarantee that I didn't imagine this, but IIRC the go tool does not re-build outdated packages accross GOPATH directories. For the life of me, I can't seem to find any documentation or issues discussing it.
Not so. See "Getting started with the go command" <https://golang.org/doc/articles/go_command.html#tmp_3>:Because the go command can analyze the dependency graph, "go install" also installs any packages that this package imports but that are out of date, recursively.It'd be pretty rubbish if it didn't.
export GOPATH=${HOME}/vendor:${HOME}/golang
There's a library in vendor/src/mylib/file1.go that is imported by golang/src/myapp/main.go.
[...] Now, let's suppose there's a change to file1.go
Any changes to files in the vendor/ directory don't seem to trigger rebuilding the library binary.
Is this expected behavior?
On Sunday, 28 December 2014 22:45:54 UTC, James Graves wrote:export GOPATH=${HOME}/vendor:${HOME}/golang
There's a library in vendor/src/mylib/file1.go that is imported by golang/src/myapp/main.go.
[...] Now, let's suppose there's a change to file1.goWait, what? How did this happen? Is this package vendored or forked?* If vendored (and not using godeps), then try 'go get -u' instead for update workflow.
When using godep is when I usually run into this, and it's seriously annoying. The "how did it happen" in that case is usually something along the lines of "git pull; ./build.sh" where the build script uses godep.Since that uses a "split" $GOPATH, and those are mentioned on the actual line to "go install" or whatever, the dependencies don't get rebuilt. If there were API changes in them, weird hilariousness ensues, sometimes followed by bug reports.