Date: Sat, 22 Jun 2019 14:31:24 -0600 From: Adam Weinberger <adamw@adamw.org> To: Bernhard Froehlich <decke@bluelife.at> Cc: "Danilo G. Baio" <dbaio@freebsd.org>, FreeBSD Ports <freebsd-ports@freebsd.org>, Matthias Fechner <idefix@fechner.net> Subject: Re: How to handle go dependencies Message-ID: <CAP7rwchtYTf5XPoTgk6B2drdPjzP%2B5opq-sN=kGsTJei6dT_Dg@mail.gmail.com> In-Reply-To: <5d0e8e03.1c69fb81.5e249.9640@mx.google.com> References: <5d0e8e03.1c69fb81.5e249.9640@mx.google.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 22, 2019 at 2:22 PM Bernhard Froehlich <decke@bluelife.at> wrot= e: > > > Am 22.06.2019 19:47 schrieb Adam Weinberger <adamw@adamw.org>: > > > > On Sat, Jun 22, 2019 at 11:10 AM Bernhard Froehlich <decke@bluelife.at>= wrote: > > > > > > > > > Am 22.06.2019 17:56 schrieb Adam Weinberger <adamw@adamw.org>: > > > > > > > > On Sat, Jun 22, 2019 at 8:21 AM Danilo G. Baio <dbaio@freebsd.org> = wrote: > > > > > > > > > > On Sat, Jun 22, 2019 at 11:58:49AM +0200, Matthias Fechner wrote: > > > > > > Dear all, > > > > > > > > > > > > I just prepare the gitlab-ce upgrade to version 12.0.0. > > > > > > But I have some problem with a package that uses go to compile. > > > > > > > > > > > > The new version of devel/gitaly has changed the way the package= is defined. > > > > > > They removed now all files from the vendor/ folder and add depe= ndencies > > > > > > in a `go.mod` file. > > > > > > > > > > > > If I now build the port it tries to fetch the files while no ne= twork > > > > > > access is allowed. > > > > > > > > > > > > What is the correct way to getting these dependencies fetched a= nd > > > > > > correctly included into the work-source in the fetch step using= go? > > > > > > > > > > > > Thanks a lot! > > > > > > > > > > > > Gru=C3=9F > > > > > > Matthias > > > > > > > > > > > > > > > > Try this and remove the go.mod file > > > > > > > > > > ports-mgmt/modules2tuple > > > > > https://github.com/dmgk/modules2tuple > > > > > > > > > > Examples: > > > > > net/geoipupdate > > > > > shells/antibody > > > > > > > > Just a note here, both those ports are mine, and I have no idea if > > > > that's the right thing to do; it built right so I did it. I don't > > > > understand Go packaging at all, and I'd sure appreciate someone wit= h > > > > Go knowledge verifying whether removing go.mod is the proper thing = to > > > > do. > > > > > > The correct magic that you are searching is: > > > > > > MAKE_ENV+=3D GOFLAGS=3D-mod=3Dvendor > > > > > > (like it is used in mail/smtprelay) > > > > With that I still get: > > > > $GOPATH/go.mod exists but should not > > *** Error code 1 > > > > Stop. > > > > Which port is that? I had a look at shells/antibody which you mentioned a= nd came up with that: > > --- /home/decke/dev/ports/shells/antibody/Makefile 2019-06-12 18:57:= 58.189631000 +0000 > +++ /home/decke/dev/myports/shells/antibody/Makefile 2019-06-22 20:13:= 05.627718000 +0000 > @@ -21,23 +21,18 @@ > > USE_GITHUB=3D yes > GH_ACCOUNT=3D getantibody > -GH_SUBDIR=3D src/github.com/${GH_ACCOUNT_DEFAULT}/${PORTNAME} > # Not needed: go-spew, go-difflib > -GH_TUPLE=3D alecthomas:kingpin:a39589:kingpin/src/github.com/alecth= omas/kingpin \ > - alecthomas:template:a0175e:tempalte/src/github.com/alecth= omas/template \ > - alecthomas:units:2efee8:units/src/github.com/alecthomas/u= nits \ > - caarlos0:gohome:75f08ebc:gohome/src/github.com/caarlos0/g= ohome \ > - getantibody:folder:v1.0.0:folder/src/github.com/getantibo= dy/folder \ > - golang:crypto:1a580b:crypto/src/golang.org/x/crypto \ > - golang:net:2491c5:net/src/golang.org/x/net \ > - golang:sync:1d60e4:sync/src/golang.org/x/sync \ > - golang:sys:7c87d1:sys/src/golang.org/x/sys > +GH_TUPLE=3D alecthomas:kingpin:a39589:kingpin/vendor/github.com/ale= cthomas/kingpin \ > + alecthomas:template:a0175e:template/vendor/github.com/ale= cthomas/template \ > + alecthomas:units:2efee8:units/vendor/github.com/alecthoma= s/units \ > + caarlos0:gohome:75f08ebc:gohome/vendor/github.com/caarlos= 0/gohome \ > + getantibody:folder:v1.0.0:folder/vendor/github.com/getant= ibody/folder \ > + golang:crypto:1a580b:crypto/vendor/golang.org/x/crypto \ > + golang:net:2491c5:net/vendor/golang.org/x/net \ > + golang:sync:1d60e4:sync/vendor/golang.org/x/sync \ > + golang:sys:7c87d1:sys/vendor/golang.org/x/sys > > -do-build: > - ${RM} ${WRKSRC}/go.mod > - cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${BUILD_ENV} GOPATH=3D${WRK= SRC} go build > - > -do-install: > - ${INSTALL_PROGRAM} ${WRKSRC}/antibody-${PORTVERSION} ${STAGEDIR}$= {PREFIX}/bin/antibody > +GO_PKGNAME=3D github.com/getantibody/antibody > +MAKE_ENV+=3D GOFLAGS=3D-mod=3Dvendor > > .include <bsd.port.mk> > > It looks much more complicated than it is. In GH_TUPLE replace src with v= endor to have the dependencies in the path where go will look for. Add GOFL= AGS=3D-mod=3Dvendor to force go to use the sources it finds there and ignor= e go.mod/go.sum And last but not least set GO_PKGNAME and let our Uses/go.m= k do the magic. Wow, I had no idea about any of this! Please, can you add a Wiki page for how to do Go ports? Or send some text (even in plain text format) to the doc team and they can format it for the PHB. # Adam --=20 Adam Weinberger adamw@adamw.org https://www.adamw.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAP7rwchtYTf5XPoTgk6B2drdPjzP%2B5opq-sN=kGsTJei6dT_Dg>