From f52ff687985b007cd4d8b6a40fda10a24b118d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Tue, 13 Oct 2020 12:57:28 +0200 Subject: [PATCH] spec: fix %check on ELN %gotest ./... was failing on ELN because it couldn't find the vendored dependencies. Let me explain why this worked before: In Fedora, we don't use vendored deps, therefore we had no issue. In RHEL8, we use vendored deps and -mod=vendor with GO111MODULE unset. In this case, vendored deps were indeed used. However, ELN added GO111MODULE=off. When modules are disabled, -mod=vendor is ignored[1]. It turns out that go with disabled modules uses vendor directory only in case when $(pwd) is inside GOPATH. Don't ask me why. Therefore, this fix uses cd to ensure that pwd inside GOPATH (even though technically we're still in the same directory). Note that in %build we already had this magic cd command, therefore it wasn't an issue there. [1]: Actually `GO111MODULE=off go build -mod=vendor` returns an error. However, `GO111MODULE=off GOFLAGS=-mod=vendor go build` just ignores the go flag from env. Fixes #rhbz1884383 --- osbuild-composer.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osbuild-composer.spec b/osbuild-composer.spec index 6916a8f48..cf9fb5533 100644 --- a/osbuild-composer.spec +++ b/osbuild-composer.spec @@ -209,6 +209,8 @@ install -m 0755 -vp test/data/vendor/dnsname %{buildroot}%{_d %if 0%{?rhel} export GOFLAGS=-mod=vendor export GOPATH=$PWD/_build:%{gopath} +# cd inside GOPATH, otherwise go with GO111MODULE=off ignores vendor directory +cd $PWD/_build/src/%{goipath} %gotest ./... %else %gocheck