Bug 2050088 - [EPEL] 1.15 → 1.16 regression with GOROOT breaks cockpit build
Summary: [EPEL] 1.15 → 1.16 regression with GOROOT breaks cockpit build
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: golang
Version: epel7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dave Dykstra
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-03 08:49 UTC by Martin Pitt
Modified: 2022-07-12 14:52 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-02-09 13:02:22 UTC
Type: Bug
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github cockpit-project bots issues 2883 0 None open rhel-7-9 image refresh failure: package cockpit-kube-auth is not in GOROOT 2022-02-03 09:05:31 UTC
Red Hat Issue Tracker FC-514 0 None None None 2022-07-12 14:52:08 UTC

Description Martin Pitt 2022-02-03 08:49:23 UTC
Description of problem: Recently, the Go compiler was updated in EPEL for RHEL 7 from 0:1.15.14-1.el7 to 0:1.16.13-2.el7.

This broke the building of the current RHEL 7 cockpit package [1]:

    GOPATH=/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone /usr/bin/go build -ldflags "-B 0x"`head -c20 /dev/urandom|od -An -tx1|tr -d ' \n'` "cockpit-kube-auth"

fails with

    package cockpit-kube-auth is not in GOROOT (/usr/lib/golang/src/cockpit-kube-auth)

I don't have any idea of Go (this is an old stable branch, the Go parts predate me and it has long been removed from RHEL 8/9 and main). But as far as I understand [2], one is *not* supposed to define $GOROOT when using distribution packages -- the builtin default (/usr/lib/golang/src) seems quite reasonable. I still understand the docs [2] that one should set GOPATH for building custom go packages, such as the one in cockpit's srpm.

Nevertheless, I experimented with this a bit, to no avail:


$ GOROOT=/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone GOPATH=/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone /usr/bin/go build -ldflags "-B 0x"`head -c20 /dev/urandom|od -An -tx1|tr -d ' \n'` "cockpit-kube-auth"
warning: GOPATH set to GOROOT (/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone) has no effect
pkg/kubernetes/standalone/src/cockpit-kube-auth/helpers/client.go:23:2: package bytes is not in GOROOT (/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone/src/bytes)
pkg/kubernetes/standalone/src/cockpit-kube-auth/helpers/client.go:24:2: package crypto/tls is not in GOROOT (/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone/src/crypto/tls)
[...]

→ Now it can't find its standard library packages any more, which is expected, I suppose? So let's try to add that:

$ GOROOT=/usr/lib/golang/src:/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone GOPATH=/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone /usr/bin/go build -ldflags "-B 0x"`head -c20 /dev/urandom|od -An -tx1|tr -d ' \n'` "cockpit-kube-auth"
go: cannot find GOROOT directory: /usr/lib/golang/src:/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone

→ Not using the standard ":" path separator either, or it doesn't support multiple paths in the first place (I suspect the latter).


I also dropped the "-ldflags" bits - I think that's just some kind of random build ID, but it doesn't influence this bug.

So at this point I don't know what to do -- at first sight this *looks* broken. Is there some workaround, or are we doing things wrong?


Version-Release number of selected component (if applicable):

golang-bin-0:1.16.13-2.el7

[1] https://logs.cockpit-project.org/logs/pull-2885-20220203-023426-fea26358-rhel-7-9-cockpit-project-cockpit-rhel-7.9/log.html
[2] https://golangdocs.com/gopath-and-goroot-in-go-programming

Comment 3 Martin Pitt 2022-02-03 09:05:32 UTC
I also tried to give it the full path to the package, instead of just the name:

  $ GOPATH=/builddir/build/BUILD/cockpit-195.12.x/pkg/kubernetes/standalone /usr/bin/go build pkg/kubernetes/standalone/src/cockpit-kube-auth/                  
  package pkg/kubernetes/standalone/src/cockpit-kube-auth is not in GOROOT (/usr/lib/golang/src/pkg/kubernetes/standalone/src/cockpit-kube-auth)

At this point it's behaving exactly like I didn't specify $GOROOT at all:

  $ /usr/bin/go build cockpit-kube-auth                               
  package cockpit-kube-auth is not in GOROOT (/usr/lib/golang/src/cockpit-kube-auth)

I just don't understand how GOROOT is related to finding packages? I though that was the location of the Go compiler and library?

Comment 4 Martin Pitt 2022-02-03 18:23:12 UTC
The 1.16 release notes[1] mention some GO111MODULE change. Setting this to "auto" effectively works around the problem indeed [2]. However, the error message is really .. unhelpful.

So feel free to close this as WONTFIX.

[1] https://go.dev/doc/go1.16
[2] https://github.com/cockpit-project/cockpit/pull/16921

Comment 5 Tilmann Scheller 2022-02-09 11:33:25 UTC
Moving to EPEL product

Comment 6 Dave Dykstra 2022-02-09 13:02:22 UTC
Thank you for reporting the problem and the fix.  

However, this is the upstream behavior, so we won't do anything in this distribution.  Closing as NOTABUG.


Note You need to log in before you can comment on or make changes to this bug.