Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] dev-lang/go
Date: Wed, 01 Jan 2014 06:51:16
Message-Id: CAAr7Pr8ZH4-6gbyh+TbyTta-XWkFS14jHo5kA+Lt_qDLNh41Gg@mail.gmail.com
In Reply to: [gentoo-dev] dev-lang/go by Emery Hemingway
1 On Mon, Dec 30, 2013 at 12:48 PM, Emery Hemingway <emery@×××××××.net> wrote:
2
3 > I really like working with Go, and would like to see a means of merging
4 > Go packages with Portage. In short I am asking if anyone else is
5 > interested in a Go project.
6 >
7 >
8 > For those who aren't familiar with Go, I will sumarise why Portage and
9 > Go do not play well together.
10 >
11 > Go is static linked by default.
12 > The Go compiler creates static libraries and binaries. Libraries
13 > compilied with different versions of Go (1.1/1.2) may not be linked
14 > into the same binary.
15 >
16 > It is possible to compile dynamicly and that may involve using the
17 > GCC frontend, which is probably less tested and less optimized.
18 >
19 >
20 > Go libraries are usually unversioned.
21 > Libraries outside the system library are resolved with an import
22 > statement that specifies a source code repository, such as a git or
23 > mecurial repository. Most often Go libraries are installed using the
24 > 'go get' tool that clones a repository, and simply assumes HEAD/tip is
25 > the best revision to build against. There is some support for using git
26 > tags but it is not well documented. Often these libraries are very
27 > small for the sake of reuse and to keep APIs simple.
28 >
29 > If all that sounds bad, thats because it is. Is it worth versioning
30 > many tiny libraries or do we simply cache the repositiories and blame
31 > upstream when things stop compiling?
32 >
33 >
34 > A have made an eclass for Go and an ebuild for the bitcoin node written
35 > in pure Go to atleast prove that all this is possible. These are in the
36 > 'emery' overlay:
37 > http://git.overlays.gentoo.org/gitweb/?p=user/emery.git;a=tree;f=eclass
38 > http://git.overlays.gentoo.org/gitweb/?p=user/emery.git;a=tree;f=dev-go
39 >
40 > http://git.overlays.gentoo.org/gitweb/?p=user/emery.git;a=tree;f=net-p2p/btcd
41 >
42 > The eclass it a bit of a mess but it works, having done that, I would
43 > say that making ebuilds for every go library is tedious, but can be
44 > done almost entirely with boilerplate, almost every time.
45 >
46 >
47 Don't we basically do this with perl and g-cpan?
48
49
50 > The eclasss installs go source and static libraries
51 > to /usr/lib/go/gentoo (source code and .a library are required to link).
52 > The problem is when Go is updated, this folder may get wiped out, and
53 > if it isn't, those libraries will be incompatable with the new release
54 > anyway.
55 >
56
57 Can we version the shared objects in the golang they were compiled for?
58
59 /usr/lib/go/gentoo/GO_TOOLCHAIN_VERSION/...
60
61
62 >
63 > The other solution I see is to make a Go directory in /var/cache or
64 > something like it and just manage it as a cache. Libraries may come and
65 > go but that is fine. Bare repositories may be cached in DISTDIR just
66 > like the git and mercurial eclasses do. Doing things this way may
67 > require a specific utility for Portage that wraps the Go toolchain,
68 > which I would be willing to create. This utility could probably
69 > automatically resolve and fetch the libraries that are required as
70 > opposed to making an ebuild for each library, but that raises the
71 > problem of assuming the developers of each library maintain consistant
72 > quality and security.
73 >
74
75 I feel like this is not a great idea. What your idea as proposed reads like
76 to me is 'hey i want to move some libraries into /var/cache..cause you
77 know...we can delete the libraries at any time...and we can just recompile
78 them!'
79
80
81 >
82 >
83 > The problem is Go makes it trivial to build from source, but it does
84 > that in a very different and less precise way than Gentoo. There is
85 > always the option of build bots and installing binaries to /opt...
86 >
87 >
88 > Emery
89 >
90 >