#12 Force GO111MODULE=off till the macros grow Go module support
Merged 9 months ago by nim. Opened 9 months ago by nim.
nim/go-rpm-macros nomodules  into  master

file modified
+13 -11

@@ -384,19 +384,20 @@ 

  

  listfiles() {

  local goipath="${1}"

- GOPATH="${sourcedir}" \

+ GOPATH="${sourcedir}" GO111MODULE=off \

    golist --to-install --package-path ${goipath} $(expandflags)

  }

  

  checks() {

  local goipath="${1}"

- GOPATH="${workroot}${GOPATH+:${GOPATH}}" \

+ GOPATH="${workroot}${GOPATH+:${GOPATH}}" GO111MODULE=off \

    golist --provided --tests --package-path ${goipath} $(expandflags) |\

      while read -r -d $'\n' dir ; do

        pushd "${workroot}/src/${dir}" >/dev/null

          echo "${dir}"

-         GOPATH="${workroot}${GOPATH:+:${GOPATH}}:${gopath}" \

-           PATH="${workbin:+${workbin}:}${PATH}" \

+              GOPATH="${workroot}${GOPATH:+:${GOPATH}}:${gopath}" \

+                PATH="${workbin:+${workbin}:}${PATH}" \

+         GO111MODULE=off \

            go test ${GO_TEST_FLAGS} -ldflags "${LDFLAGS:+${LDFLAGS} }-extldflags '${GO_TEST_EXT_LD_FLAGS}'"

        popd >/dev/null

      done

@@ -415,7 +416,7 @@ 

  provides() {

  local goipath="${1}"

  fullprovides golang-ipath "${goipath}"

- GOPATH="${prefix}${gopath}" \

+ GOPATH="${prefix}${gopath}" GO111MODULE=off \

    golist --provided --package-path "${goipath}" $(expandflags) |\

      while read -r -d $'\n' prov ; do

        fullprovides golang "${prov}"

@@ -424,7 +425,7 @@ 

  

  requires() {

  local goipath="${1}"

- GOPATH="${prefix}${gopath}" \

+ GOPATH="${prefix}${gopath}" GO111MODULE=off \

    golist --imported --package-path "${goipath}" $(expandflags) --skip-self |\

      while read -r -d $'\n' req ; do

        echo "golang($req)"

@@ -459,11 +460,12 @@ 

                      workroot="${sourcedir}"

                      workbin="${bindir}"

                    fi

-                   echo "Testing in: ${workroot}/src"

-                   echo "      PATH: ${workbin:+${workbin}:}${PATH}"

-                   echo "    GOPATH: ${workroot}${GOPATH:+:${GOPATH}}:${gopath}"

-                   echo "   command: go test ${GO_TEST_FLAGS} -ldflags \"${LDFLAGS:+${LDFLAGS} }-extldflags '${GO_TEST_EXT_LD_FLAGS}'\""

-                   echo "   testing: ${goipath}"

+                   echo "Testing    in: ${workroot}/src"

+                   echo "         PATH: ${workbin:+${workbin}:}${PATH}"

+                   echo "       GOPATH: ${workroot}${GOPATH:+:${GOPATH}}:${gopath}"

+                   echo "  GO111MODULE: off"

+                   echo "      command: go test ${GO_TEST_FLAGS} -ldflags \"${LDFLAGS:+${LDFLAGS} }-extldflags '${GO_TEST_EXT_LD_FLAGS}'\""

+                   echo "      testing: ${goipath}"

                    checks "${goipath}" ;;

    provides)       while read lockfile ; do

                      dir=$(dirname "${lockfile}")

file modified
+1 -1

@@ -133,7 +133,7 @@ 

  provides() {

  local goipath="${1}"

  fullprovides golang-symlink "${goipath}"

- GOPATH="${prefix}${gopath}" \

+ GOPATH="${prefix}${gopath}" GO111MODULE=off \

    golist --provided --package-path "${goipath}" $(expandflags) |\

      while read -r -d $'\n' prov ; do

        fullprovides golang "${prov}"

@@ -26,10 +26,10 @@ 

    # https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12

    %global _dwz_low_mem_die_limit 0

    %ifnarch ppc64

-   %{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} \\

+   %{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} GO111MODULE=off \\

    go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x %{?**};

    %else

-   %{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} \\

+   %{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} GO111MODULE=off \\

    go build                -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}'" -a -v -x %{?**};

    %endif

  }

@@ -38,4 +38,4 @@ 

  # Define commands for testing

  %gotestflags      -buildmode pie -compiler gc

  %gotestextldflags %__global_ldflags %{?__golang_extldflags}

- %gotest() go test %{gotestflags} -ldflags "${LDFLAGS:-}%{?currentgoldflags} -extldflags '%{gotestextldflags}'" %{?**};

+ %gotest() GO111MODULE=off go test %{gotestflags} -ldflags "${LDFLAGS:-}%{?currentgoldflags} -extldflags '%{gotestextldflags}'" %{?**};

@@ -182,8 +182,10 @@ 

    end

    print(rpm.expand('%goenv ' .. zsuffix                .. myenvflags .. '\\n'             ..

                     '%{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" }' ..

+                    'GO111MODULE=off ' ..

                     "golist --imported --package-path " .. golistargs .. "--skip-self\\n" ..

                     '%{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" }' ..

+                    'GO111MODULE=off ' ..

                     "golist --imported --package-path " .. golistargs .. "--skip-self --tests\\n"))

  end

  -- Main loop