#!/usr/bin/env bash if [[ -z "${RPM_BUILD_ROOT}" ]]; then export RPM_BUILD_ROOT="$(cat /tmp/buildrootpath.txt)" fi # Exclude the existing contrib directory from GOPATH, otherwise there might be # incorrect requirements listed. tmpgopath= for entry in $(echo "${GOPATH}" | tr ':' '\n'); do [[ -z "${entry}" || "${entry}" =~ 'contrib' ]] && continue if [[ -z "${tmpgopath}" ]]; then tmpgopath="${entry}" else tmpgopath="${tmpgopath}:${entry}" fi done export GOPATH="${RPM_BUILD_ROOT}/usr/share/go/$(rpm --eval %go_api_ver)/contrib:${tmpgopath}" export GO15VENDOREXPERIMENT=1 IMPORT="$(cat /tmp/importpath.txt)" while read INPUT; do : done for SEGMENT in $(go list -f '{{range $deps := .Deps}}{{printf "%s\n" $deps}}{{end}}' ${IMPORT}/... | grep -v ${IMPORT} | sort -u); do STANDARD=$(go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ${SEGMENT} 2> /dev/null) if [[ $? -ne 0 || "${STANDARD}" != "" ]]; then echo "golang(${SEGMENT})" fi done