But maybe its already there and I am just too dumb to see it.
You build with go, it wants this
gopath/src/project/somemainstuff/
gopath/src/project/package_one/
gopath/src/project/package_two/
gopath/src/project/package_three/
For some reason I cant remember, I followed the go source tree layout
within my projects, i.e.
gopath/src/somemainstuff/
gopath/src/pkg/package_one/
gopath/src/pkg/package_two/
gopath/src/pkg/package_three/
I get the "package could not be found locally". I fixed it but I thought
it could be very helpful in some projects, that you could give go some
more searchpaths when trying to find packages, relative to gopath/src, like
go build somemainstuff -s pkg -s project/pkg would also try to find the
source for imports within gopath/src/pkg and gopath/src/project/pkg. Is
this possible already? Does someone have an example?
Cheers,
C.
You see?
Oh, sure, that I saw. But it will always search src/... below the
gopath, but never src/pkg/...You see?
What popped into my mind was that it might come in handy for bigger
projects if you could structure them within the src/project path, like
src/project/network/foo and src/project/gui/bar. Or
src/project/linux_386/foo and src/project/win_64/foo, if that is needed.
The package you import is just foo. Hmm, now looking at this. If I have
a bunch of generic packages, that I use in most of my apps, how could I
reference them without belonging to the project, but within my source
directory. Means if I do go build foo and have my generic packages in
anothergopath/src/generic, not in foogopath/src/foo, could that be done
with some magic command line? Or just a symbolic link would do?
Cheers,
C.
The import within the source file should be "foo".
You can alter the go command source to run your code generators.I hacked a "fix" into cmd/go/build.go of weekly at line 890 (assuming you're using the gc toolchain and no cgo or asm, idk about otherwise) to and run pre- and post-build scripts. Messy, but the tools are open source after all.
This can't help anyone who wants to use your software. If you can't
use the go command, for whatever reason, use makefiles. A private fork
is just more work for you to do.
--
Aram Hăvărneanu