From owner-freebsd-ports@freebsd.org Sat Jun 22 20:52:16 2019 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3536215B8924 for ; Sat, 22 Jun 2019 20:52:16 +0000 (UTC) (envelope-from dg@syrec.org) Received: from mail.syrec.org (mail.syrec.org [165.227.215.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D6338C1A9; Sat, 22 Jun 2019 20:52:14 +0000 (UTC) (envelope-from dg@syrec.org) Received: from xombo.localdomain (unknown [186.43.128.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.syrec.org (Postfix) with ESMTPSA id 8145E49C38; Sat, 22 Jun 2019 15:52:07 -0500 (-05) Date: Sat, 22 Jun 2019 15:52:05 -0500 From: Dmitri Goutnik To: Adam Weinberger Cc: Bernhard Froehlich , Matthias Fechner , FreeBSD Ports , "Danilo G. Baio" Subject: Re: How to handle go dependencies Message-ID: <20190622205205.GB40599@xombo.localdomain> Mail-Followup-To: Adam Weinberger , Bernhard Froehlich , Matthias Fechner , FreeBSD Ports , "Danilo G. Baio" References: <5d0e8e03.1c69fb81.5e249.9640@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) X-Rspamd-Queue-Id: 8D6338C1A9 X-Spamd-Bar: - X-Spamd-Result: default: False [-1.99 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[syrec.org:s=201902]; NEURAL_HAM_MEDIUM(-0.45)[-0.448,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.32)[ipnet: 165.227.208.0/20(0.55), asn: 14061(1.12), country: US(-0.06)]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[syrec.org:+]; MX_GOOD(-0.01)[mail.syrec.org]; DMARC_POLICY_ALLOW(-0.50)[syrec.org,quarantine]; NEURAL_SPAM_SHORT(0.14)[0.139,0]; RECEIVED_SPAMHAUS_PBL(0.00)[115.128.43.186.zen.spamhaus.org : 127.0.0.11]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:14061, ipnet:165.227.208.0/20, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jun 2019 20:52:16 -0000 On 19-06-22 14:31:24, Adam Weinberger wrote: > On Sat, Jun 22, 2019 at 2:22 PM Bernhard Froehlich wrote: > > > > > > Am 22.06.2019 19:47 schrieb Adam Weinberger : > > > > > > On Sat, Jun 22, 2019 at 11:10 AM Bernhard Froehlich wrote: > > > > > > > > > > > > Am 22.06.2019 17:56 schrieb Adam Weinberger : > > > > > > > > > > On Sat, Jun 22, 2019 at 8:21 AM Danilo G. Baio 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 dependencies > > > > > > > in a `go.mod` file. > > > > > > > > > > > > > > If I now build the port it tries to fetch the files while no network > > > > > > > access is allowed. > > > > > > > > > > > > > > What is the correct way to getting these dependencies fetched and > > > > > > > correctly included into the work-source in the fetch step using go? > > > > > > > > > > > > > > Thanks a lot! > > > > > > > > > > > > > > Gruß > > > > > > > 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 with > > > > > Go knowledge verifying whether removing go.mod is the proper thing to > > > > > do. > > > > > > > > The correct magic that you are searching is: > > > > > > > > MAKE_ENV+= GOFLAGS=-mod=vendor > > > > > > > > (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 and 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= yes > > GH_ACCOUNT= getantibody > > -GH_SUBDIR= src/github.com/${GH_ACCOUNT_DEFAULT}/${PORTNAME} > > # Not needed: go-spew, go-difflib > > -GH_TUPLE= alecthomas:kingpin:a39589:kingpin/src/github.com/alecthomas/kingpin \ > > - alecthomas:template:a0175e:tempalte/src/github.com/alecthomas/template \ > > - alecthomas:units:2efee8:units/src/github.com/alecthomas/units \ > > - caarlos0:gohome:75f08ebc:gohome/src/github.com/caarlos0/gohome \ > > - getantibody:folder:v1.0.0:folder/src/github.com/getantibody/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= alecthomas:kingpin:a39589:kingpin/vendor/github.com/alecthomas/kingpin \ > > + alecthomas:template:a0175e:template/vendor/github.com/alecthomas/template \ > > + alecthomas:units:2efee8:units/vendor/github.com/alecthomas/units \ > > + caarlos0:gohome:75f08ebc:gohome/vendor/github.com/caarlos0/gohome \ > > + getantibody:folder:v1.0.0:folder/vendor/github.com/getantibody/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=${WRKSRC} go build > > - > > -do-install: > > - ${INSTALL_PROGRAM} ${WRKSRC}/antibody-${PORTVERSION} ${STAGEDIR}${PREFIX}/bin/antibody > > +GO_PKGNAME= github.com/getantibody/antibody > > +MAKE_ENV+= GOFLAGS=-mod=vendor > > > > .include > > > > It looks much more complicated than it is. In GH_TUPLE replace src with vendor to have the dependencies in the path where go will look for. Add GOFLAGS=-mod=vendor to force go to use the sources it finds there and ignore go.mod/go.sum And last but not least set GO_PKGNAME and let our Uses/go.mk 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 > > > -- > Adam Weinberger > adamw@adamw.org > https://www.adamw.org > _______________________________________________ > freebsd-ports@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-ports > To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org" Can be further simplified by using USES=go:modules. This will remove the need to modify MAKE_ENV as go.mk will then add -mod=vendor flag automagically. -- Dmitri Goutnik dg@syrec.org