Thanks for your reply. For me things are only getting more confusing so I
can only offer generic advice.
On 30 Oct 2014 14:23, "Eric Duncan" wrote:
Thanks Dave! Feel honored to get a reply from the guy who floods my
tweeter feed. :)
See inlines below.
On Wed, Oct 29, 2014 at 6:50 PM, Dave Cheney wrote:
On Thursday, 30 October 2014 08:09:22 UTC+11, edunc...@gmail.com wrote:
Ok, I think I have a valid issue that raises to the rank of allowing me
to post into this awesome forum for an awesome language. :)
I have a constant problem across two Linux developer VMs over the last
several months. Both are running Debian (one stable, one testing). They
both experience this issue off and on, and today it has cost me too much
time to the point that I just copied all files locally to get past this
It is an issue with developing my own packages - both for internal
(private repos) and external uses.
Problem: Once I import them into another executable/main() app, and
then I go back and modify that package, the changes to the package are not
detected by the main() app I imported it into, built and used before. go
build, go clean, go test, etc does not bring in the changes.
You need to use go install to install those packages.
Humm. I actually haven't been doing "go get" or "go install" for these
packages I developed locally. I reference them in the tooling, and it has
been working (like I said, caching the original version I have locally for
24 hours, then I see changes I made to the package). The tool I use them
in, I just referenced as import and they worked. But, I can see how that
would work by moving them into the /pkg/ directory.
I don't understand why 24 hours is important, unless the clock on your
computer is running backwards.
The go tool, like most build tools compares the time of the source file
with the compiled file (in GOPATH/pkg).
And I see the other packages I developed in /pkg/ as well. Now I am
thinking that it does get installed somehow with "go get ." on the tooling,
and that's why I have a cached version there.
Go get checks out the source using the bane of the package to figure out
where the source repo lives then calls go install. There isn't any more
magic than that, I'd you aren't trying to fetch someone else's changes, you
don't need to be online.
This may be my lack of understanding of how to develop and test (test
with external programs) packages locally.
How would I continue to develop/change the package code as I continued to
develop the tool/runtime, if it is located in $GOPATH/pkg/
GOPATH/pkg is for use by the go tool, don't touch anything in there
instead of $GOPATH/src/? I ask because I often find myself adding features
onto (or changing the API) of those packages I reference as I develop the
tooling or what consumes them. Must I, 1) edit package code, 2) push
changes up to repo 3) run go install for each small tweak locally?
Nope, just use go install, always and you'll have no problems.
I often times prototype changes in packages, which is something I don't
want to commit up to a public repo (which I can get around with branches,
The fact that the source lives in a directory that is under Git's control
isn't important to the build process.
(I often develop offline, during my 4 hour commute)
The process is:
* I create a package at ~/go/src/github.com/eduncan911/mypackage
* Write some code, tests, etc. It all works.
* Commit code to remote repo.
* I create an app at ~/go/src/github.com/eduncan911/mymainapp
* I reference the first package, build mymainapp, go test, run it, etc.
Problem: Now, I go back and edit the original `mypackage` - the changes
do not take affect in mymainapp.*
* most of the time. sometimes, the package changes are picked up right
away like they should be.
This is likely to be a problem with your GOPATH configuration.
Can you post the entire output from
go install -x github.com/eduncan911/mymainapp
I think you meant the package, not the /mymainapp? For /mymainapp, it's
located in a sub-sub-sub folder of other tools outside of my gopath. So,
if i run go install on it, it looks like this:
Ok, this is probably the problem,
1. Don't use symlinks to symlink source into your GOPATH, the go tool will
2. Move all your go code into your GOPATH
3. If your GOPATH contains multiple elements, collapse them into a single
Then everything will work properly.
can't load package: package
github.com/[company]/sp-api-client/go/sp-updated-since: cannot find package
"github.com/[company]/sp-api-client/go/sp-updated-since" in any of:
github.com/[company]/sp-api-client/go/sp-updated-since (from $GOROOT)
Which is true because it lives in a different directory along with other
tools outside of my GOPATH.
As for the package itself, it looks like:
$ go install -x github.com/[company]/publishing-api-client/client
mkdir -p $WORK/github.com/[company]/publishing-api-client/client/_obj/
mkdir -p $WORK/github.com/[company]/publishing-api-client/
/usr/local/go/pkg/tool/linux_amd64/6g -o $WORK/
github.com/[company]/publishing-api-client/client.a -trimpath $WORK -p
github.com/[company]/publishing-api-client/client -complete -D
$WORK -pack ./client.go
mkdir -p /home/eric/go/pkg/linux_amd64/
So that looks like it install the Github.com version into my /pkg/. Great!
Except, I have lots of changes locally for the /src/ version of that
...that isn't being picked up.
What would be the proper way to develop a package locally, and test it
locally in other tools/apps/runtimes without pushing changes up to a remote
repo and running "go install" for each change? Or, must I commit all local
prototyping/experimental changes up to the remote repo, run "go install" to
get them back down into /pkg/, and then run the main app locally?
Thanks for your time Dave!
Is it a problem that I am referencing a full github.com/eduncan911/
url, after I committed code, but made local changes on my machine to that
repo? I would suspect that the go app would use my local files with local
modifications, not the remote repo.
I've noticed almost exactly a 24 hour window before I can get those
changes into mymainapp. Almost like the imported package is cached.
I've rebooted countless times, deleted the package repo, etc.
I've searched and searched for this, without resolve.
To complete the details:
Go 1.3.3 (built from source, w/cross-compiling)
Thanks in advance!
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/d/optout.