Update lang/go to 1.12

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Update lang/go to 1.12

Joel Sing-3
Reply | Threaded
Open this post in threaded view
|

Re: Update lang/go to 1.12

Stuart Henderson
On 2019/02/28 04:22, Joel Sing wrote:
> The following updates lang/go to 1.12, along with the golang.org/x packages.
>
> One of the key differences between 1.11 and 1.12 is that GOCACHE is no longer
> optional, hence go.port.mk now specifies a cache location.

I've built dependent ports, diffs below for some GOCACHE fallout:

- sysutils/amazon-ssm-agent, textproc/loccount: doesn't use the module,
needs GOCACHE=${WRKDIR}/go-cache adding to MAKE_ENV

- sysutils/fleetctl, sysutils/prometheus: uses the module but not the
default targets, needs GOCACHE=${MODGO_GOCACHE} adding to do-build

Any objection to shipping packages for go-bootstrap? Otherwise people
building lang/go have an outdated bootstrap which they have to manually
rebuild. (Also included in the diff).

- sysutils/beats/packetbeat is also broken, not sure how to fix that,
maybe some vendored thing is in need of an update

cd /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap
CGO_LDFLAGS='"-g" "-O2" "-lpcap"' /usr/local/go/pkg/tool/openbsd_amd64/cgo -objdir $WORK/b354/ -importpath github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap -- -I $WORK/b354/ -g -O2 ./pcap.go ./pcap_poll_common.go
# github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap
/usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:173:7: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
/usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:385:13: identifier "_Ctype_struct_pcap_stat" may conflict with identifiers generated by cgo
/usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:446:10: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
/usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:489:21: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
/usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:552:34: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
/usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:555:56: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
/usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:821:13: identifier "_Ctype_struct_pcap_pkthdr" may conflict with identifiers generated by cgo

Index: sysutils/amazon-ssm-agent/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/amazon-ssm-agent/Makefile,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile
--- sysutils/amazon-ssm-agent/Makefile 31 Jan 2019 20:20:31 -0000 1.48
+++ sysutils/amazon-ssm-agent/Makefile 8 Mar 2019 13:55:26 -0000
@@ -29,7 +29,7 @@ ALL_TARGET= build-openbsd-386
 .endif
 
 USE_GMAKE= Yes
-MAKE_ENV= SKIP_CHECKSTYLE=Yes
+MAKE_ENV= SKIP_CHECKSTYLE=Yes GOCACHE=${WRKDIR}/go-cache
 MAKE_FILE= makefile
 
 WRKSRC= ${WRKDIR}/src/github.com/aws/amazon-ssm-agent
Index: sysutils/prometheus/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/prometheus/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- sysutils/prometheus/Makefile 14 Apr 2018 22:53:54 -0000 1.2
+++ sysutils/prometheus/Makefile 8 Mar 2019 13:55:26 -0000
@@ -25,7 +25,8 @@ USE_GMAKE = Yes
 MODULES= lang/go
 
 do-build:
- cd ${WRKSRC} && GOPATH=${MODGO_WORKSPACE} ${MAKE_PROGRAM} \
+ cd ${WRKSRC} && GOMAXPROCS=${MAKE_JOBS} GOCACHE=${MODGO_GOCACHE} \
+    GOPATH=${MODGO_WORKSPACE} ${MAKE_PROGRAM} \
     PROMU="${LOCALBASE}/bin/promu -v" build
 
 do-install:
Index: sysutils/fleetctl/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/fleetctl/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- sysutils/fleetctl/Makefile 14 Apr 2018 22:53:54 -0000 1.3
+++ sysutils/fleetctl/Makefile 8 Mar 2019 13:55:26 -0000
@@ -22,7 +22,7 @@ BUILD_DEPENDS = shells/bash
 NO_TEST = Yes
 
 do-build:
- cd ${WRKSRC} && ${LOCALBASE}/bin/bash build
+ cd ${WRKSRC} && env GOCACHE=${MODGO_GOCACHE} ${LOCALBASE}/bin/bash build
 
 do-install:
  ${INSTALL_PROGRAM} ${WRKSRC}/bin/fleetctl ${PREFIX}/bin/
Index: lang/go-bootstrap/Makefile
===================================================================
RCS file: /cvs/ports/lang/go-bootstrap/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- lang/go-bootstrap/Makefile 10 May 2018 18:41:04 -0000 1.10
+++ lang/go-bootstrap/Makefile 8 Mar 2019 13:55:26 -0000
@@ -9,16 +9,14 @@ RELEASE = 20171003
 DISTNAME = go${VERSION}-bootstrap-${RELEASE}
 PKGNAME = go-bootstrap-${VERSION}.${RELEASE}
 CATEGORIES = lang
-REVISION = 0
+REVISION = 1
 
 HOMEPAGE = https://golang.org/
 
 MAINTAINER = Joel Sing <[hidden email]>
 
 # software: BSD, documentation: CC-BY-3.0
-PERMIT_PACKAGE_CDROM = bootstrap only
-PERMIT_PACKAGE_FTP = bootstrap only
-PERMIT_DISTFILES_FTP = bootstrap only
+PERMIT_PACKAGE_CDROM = Yes
 
 WANTLIB = c m pthread
 

Reply | Threaded
Open this post in threaded view
|

Re: Update lang/go to 1.12

Joel Sing-3
On 19-03-08 14:03:29, Stuart Henderson wrote:

> - sysutils/beats/packetbeat is also broken, not sure how to fix that,
> maybe some vendored thing is in need of an update
>
> cd /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap
> CGO_LDFLAGS='"-g" "-O2" "-lpcap"' /usr/local/go/pkg/tool/openbsd_amd64/cgo -objdir $WORK/b354/ -importpath github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap -- -I $WORK/b354/ -g -O2 ./pcap.go ./pcap_poll_common.go
> # github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap
> /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:173:7: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
> /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:385:13: identifier "_Ctype_struct_pcap_stat" may conflict with identifiers generated by cgo
> /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:446:10: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
> /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:489:21: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
> /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:552:34: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
> /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:555:56: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
> /usr/obj/ports/packetbeat-6.4.3/go/src/github.com/elastic/beats/vendor/github.com/tsg/gopacket/pcap/pcap.go:821:13: identifier "_Ctype_struct_pcap_pkthdr" may conflict with identifiers generated by cgo

Yeah, they're doing it wrong (the code should be using C. rather than _Ctype_, which is enforced in Go 1.12)...

ok?

Index: patches/patch-vendor_github_com_tsg_gopacket_pcap_pcap_go
===================================================================
RCS file: patches/patch-vendor_github_com_tsg_gopacket_pcap_pcap_go
diff -N patches/patch-vendor_github_com_tsg_gopacket_pcap_pcap_go
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-vendor_github_com_tsg_gopacket_pcap_pcap_go 12 Mar 2019 16:43:28 -0000
@@ -0,0 +1,65 @@
+$OpenBSD$
+
+Use cgo correctly - this is enforced by Go 1.12.
+
+Index: vendor/github.com/tsg/gopacket/pcap/pcap.go
+--- vendor/github.com/tsg/gopacket/pcap/pcap.go.orig
++++ vendor/github.com/tsg/gopacket/pcap/pcap.go
+@@ -170,7 +170,7 @@ type InterfaceAddress struct {
+ // BPF is a compiled filter program, useful for offline packet matching.
+ type BPF struct {
+ orig string
+- bpf  _Ctype_struct_bpf_program // takes a finalizer, not overriden by outsiders
++ bpf  C.struct_bpf_program // takes a finalizer, not overriden by outsiders
+ }
+
+ // BlockForever, when passed into OpenLive/SetTimeout, causes it to block forever
+@@ -382,7 +382,7 @@ func (p *Handle) Error() error {
+
+ // Stats returns statistics on the underlying pcap handle.
+ func (p *Handle) Stats() (stat *Stats, err error) {
+- var cstats _Ctype_struct_pcap_stat
++ var cstats C.struct_pcap_stat
+ if -1 == C.pcap_stats(p.cptr, &cstats) {
+ return nil, p.Error()
+ }
+@@ -443,7 +443,7 @@ func (p *Handle) SetBPFFilter(expr string) (err error)
+ }
+ }
+
+- var bpf _Ctype_struct_bpf_program
++ var bpf C.struct_bpf_program
+ cexpr := C.CString(expr)
+ defer C.free(unsafe.Pointer(cexpr))
+
+@@ -486,7 +486,7 @@ func (b *BPF) String() string {
+ }
+
+ // BPF returns the compiled BPF program.
+-func (b *BPF) BPF() _Ctype_struct_bpf_program {
++func (b *BPF) BPF() C.struct_bpf_program {
+ return b.bpf
+ }
+
+@@ -549,10 +549,10 @@ func FindAllDevs() (ifs []Interface, err error) {
+ return
+ }
+
+-func findalladdresses(addresses *_Ctype_struct_pcap_addr) (retval []InterfaceAddress) {
++func findalladdresses(addresses *C.struct_pcap_addr) (retval []InterfaceAddress) {
+ // TODO - make it support more than IPv4 and IPv6?
+ retval = make([]InterfaceAddress, 0, 1)
+- for curaddr := addresses; curaddr != nil; curaddr = (*_Ctype_struct_pcap_addr)(curaddr.next) {
++ for curaddr := addresses; curaddr != nil; curaddr = (*C.struct_pcap_addr)(curaddr.next) {
+ var a InterfaceAddress
+ var err error
+ // In case of a tun device on Linux the link layer has no curaddr.addr.
+@@ -818,7 +818,7 @@ func (h *Handle) NewDumper(file string) (dumper *Dumpe
+ // Writes a packet to the file. The return values of ReadPacketData
+ // can be passed to this function as arguments.
+ func (d *Dumper) WritePacketData(data []byte, ci gopacket.CaptureInfo) (err error) {
+- var pkthdr _Ctype_struct_pcap_pkthdr
++ var pkthdr C.struct_pcap_pkthdr
+ pkthdr.caplen = C.bpf_u_int32(ci.CaptureLength)
+ pkthdr.len = C.bpf_u_int32(ci.Length)
+