Gentoo Archives: gentoo-dev

From: yac <yac@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] dev-lang/go
Date: Fri, 14 Feb 2014 23:50:39
Message-Id: 20140215004844.49e9b7f2@gentoo.org
In Reply to: Re: [gentoo-dev] dev-lang/go by Emery Hemingway
1 On Fri, 14 Feb 2014 11:02:49 -0500
2 Emery Hemingway <emery@×××××××.net> wrote:
3
4 > On Fri, 14 Feb 2014 13:30:10 +0100
5 > Jan Matejka <yac@g.o> wrote:
6 >
7 > > On Thu, 13 Feb 2014 11:59:16 -0600
8 > > William Hubbs <williamh@g.o> wrote:
9 > >
10 > > > Hi all,
11 > > >
12 > > > I responded to this a while back, but I guess my email didn't go
13 > > > out for some reason.
14 > > >
15 > > > As the primary go maintainer, I do want to be involved in
16 > > > this. :-)
17 > > >
18 > > > On Tue, Feb 11, 2014 at 01:38:44AM +0100, yac wrote:
19 > > > > On Mon, 30 Dec 2013 15:48:17 -0500
20 > > > > Emery Hemingway <emery@×××××××.net> wrote:
21 > > > >
22 > > > > > I really like working with Go, and would like to see a means
23 > > > > > of merging Go packages with Portage. In short I am asking if
24 > > > > > anyone else is interested in a Go project.
25 > > > >
26 > > > > I might be. I have packaged something for private use but it
27 > > > > just a bunch of hacks. Anyway, I have some production go code.
28 > > > >
29 > > > > >
30 > > > > > For those who aren't familiar with Go, I will sumarise why
31 > > > > > Portage and Go do not play well together.
32 > > > > >
33 > > > > > Go is static linked by default.
34 > > > > > The Go compiler creates static libraries and binaries.
35 > > > > > Libraries compilied with different versions of Go (1.1/1.2)
36 > > > > > may not be linked into the same binary.
37 > > > >
38 > > > > Haskell is staticaly linked as well (by default) and you can see
39 > > > > the gentoo haskell project. I don't see this as a problem, we
40 > > > > just will have all dependencies in DEPEND and will have to scope
41 > > > > on the go compiler version under something
42 > > > > like /usr/lib/go-1.{1,2}/...
43 > > >
44 > > > That could be done easily enough, but what about the tools
45 > > > in /usr/bin (there aren't many, but there are a couple), and these
46 > > > do not change name with each version of go.
47 > >
48 > > Please see what python does for different python versions (which you
49 > > omitted from my previous email).
50 > >
51 >
52 > I've modified the go-1.2 ebuild to install to usr/lib/go1.2 and I'm
53 > working on an eselect module to manage the symlink to
54 > usr/bin/[go,gofmt]
55 >
56 > The default GOROOT that go looks at for base libraries seems to be
57 > compiled in so this should be pretty easy, like python but simplier.
58
59 I'm not sure what you are trying to solve here. Afaik GOROOT is used to
60 determine where to install and it can be overriden from env.
61
62 > An eclass could look at a GO_MINIMUM variable and install for each
63 > version go that is present and matches.
64
65 It might be good idea to learn from others who'd been through this and
66 I think the new python eclasses are good ones, going with something
67 like PYTHON_TARGETS array (GOLANG_TARGETS ?)
68
69 > Dropping old versions of go
70 > will be easy because linking wont break, and new releases should be
71 > forwards compatible.
72
73 So far yes I think but I guess that may be quite different with in the
74 future with >1.x, and "should be" so there may be corner cases where the
75 user does need to use earlier version.
76
77 > Maybe 3rd party library sources could be stored
78 > in a version agnostic directory and symlinked in to
79 > usr/lib/goX.X/gentoo to deduplicate the files?
80
81 I'm not sure this is a good idea either. Disk space is cheap and
82 doing this would only require adding special case handling code which
83 would get even more complicated when doing upgrades or the situation
84 changes (eg. main golang version).
85
86 Also keep in mind, the main golang version should not be just "1.1" but
87 rather "go1.1" as you may also want to choose "gcc<something>".
88
89 > > > > > Go libraries are usually unversioned.
90 > > > > > Libraries outside the system library are resolved with an
91 > > > > > import statement that specifies a source code repository,
92 > > > > > such as a git or mecurial repository. Most often Go libraries
93 > > > > > are installed using the 'go get' tool that clones a
94 > > > > > repository, and simply assumes HEAD/tip is the best revision
95 > > > > > to build against. There is some support for using git tags
96 > > > > > but it is not well documented. Often these libraries are very
97 > > > > > small for the sake of reuse and to keep APIs simple.
98 > > >
99 > > > My understanding is that a library repo will have branches based
100 > > > on the version of go, so for example, it might have a branch
101 > > > called go-1 which will be where go get will look to find the
102 > > > latest version of the code that works with go-1.x.
103 > > >
104 > > > > In this case we just have to require upstream to make releases
105 > > > > or publish either live ebuilds, or ebuilds versioned something
106 > > > > like 0_preYYYY-MM-DD.ebuild [1]
107 > > >
108 > > > I don't think we are going to be able to require upstream to make
109 > > > releases, so that leaves us with:
110 > > >
111 > > > 1) using live ebuilds, which will never be allowed to have
112 > > > keywords by gentoo policy, or
113 > > > 2) publishing snapshots, which also means we have to create
114 > > > tarballs to match them. This will be a lot of work for us as
115 > > > maintainers. Also, the only way we will know when a new "version"
116 > > > of the library is released is to closely monitor the upstream git
117 > > > repository.
118 > >
119 > > As I said in previous email, I think at least part of go community
120 > > sees this as an issue and this is something we can not solve right
121 > > now but rather need to work on this on case-by-case basis.
122 > >
123 > > Some upstreams may be willing to do releases / follow semver.org or
124 > > something like that. But there will also be upstream which won't and
125 > > that's fine, we should be able to handle both cases.
126 > >
127 > > Anyway, asking the upstream to do a release is simple enough and you
128 > > won't know until you ask.
129 > >
130 > > > The other concern, which I believe zero was talking about is,
131 > > > once a library is installed in GOPATH, I don't think the go build
132 > > > system rebuilds it. In other words, "go get" will see that it is
133 > > > already there and I don't think it goes back out to the net to
134 > > > check for any changes.
135 > >
136 > > I think when doing a `go build` it will check if newer version is
137 > > available and print a warning.
138 > >
139 > We may have to make some sort of utitilty to parse sources and check
140 > for updates, and roll tarballs to mirror.
141 > >
142 > > > William
143 > > >
144 > >
145 > >
146 > >
147 > > --
148 > > Jan Matějka | Gentoo Developer
149 > > https://gentoo.org | Gentoo Linux
150 > > GPG: A33E F5BC A9F6 DAFD 2021 6FB6 3EBF D45B EEB6 CA8B
151 >
152 >
153
154
155
156 ---
157 Jan Matějka | Gentoo Developer
158 https://gentoo.org | Gentoo Linux
159 GPG: A33E F5BC A9F6 DAFD 2021 6FB6 3EBF D45B EEB6 CA8B

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] dev-lang/go William Hubbs <williamh@g.o>