On 16 Sep 2014 04:58, "Stephen Day" wrote:
We generally use symlinks into our GOPATHs to support compatibility with
existing repo layouts. For example, I have a checkout directory structure
that has existed way before we ever used Go. Symlinks are then used from
the GOPATH into that directory structure to allow us to build packages with
local changes. We could develop everything in GOPATH, but then we'd have to
instruct every one to do it the "Go Way", which has varying success. We
could reverse it, per James' instruction, but the goal is to make it easier
for adoption.
We've only really noticed problems around the usage of godoc.
Could alternative solutions to the approach of ignoring symlinks in the
go tool be found to specific problems? IMHO, the go tool shouldn't really
have opinions about the underlying structure of the file system.
But it does, its an opinionated tool.
What are the real problems with aliased packages?
>
Aliased packages mean you have two versions of the same source with
different names, so you have to independent paths for package I
initialisation.
On Thursday, September 11, 2014 6:23:22 PM UTC-7, Dave Cheney wrote:On Thursday, 11 September 2014 23:13:55 UTC+10, Nick Craig-Wood wrote:
symlinks in GOPATH don't seem to be working as I expect.
rm -rf /tmp/go /tmp/mycode
mkdir /tmp/mycode
mkdir -p /tmp/go/src/
ln -s /tmp/mycode /tmp/go/src/
cat <<EOF >/tmp/mycode/main.go
package main
import "fmt"
func main() { fmt.Println("Hello from mycode") }
EOF
export GOPATH=/tmp/go
cd /tmp/go/src/mycode
go build
/tmp/go/src/mycode/mycode
echo "installing mycode"
go install mycode && echo "OK"
echo "local directory install"
go install && echo "OK"
This prints
Hello from mycode
installing mycode
OK
local directory install
go install: no install location for directory /tmp/mycode outside
GOPATH
So having a symlink in GOPATH kind of works. It confuses other things
like go tool cover -html, and goimports.
Is this a bug, or just a not supported way of working with GOPATH ?
https://golang.org/doc/code.html is silent on the issue!
It's not supported because symlinks create aliases of packages. The go
tool goes out of it's way to ignore symlinks.
--
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 golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.