Use vendor prefix for versions if not using go mod

This commit is contained in:
Erik Wilson 2019-11-01 11:56:42 -07:00
parent b680295922
commit 01707ce451

View File

@ -8,13 +8,17 @@ PKG="github.com/rancher/k3s"
PKG_CONTAINERD="github.com/containerd/containerd"
PKG_RANCHER_CONTAINERD="github.com/rancher/containerd"
PKG_CRICTL="github.com/kubernetes-sigs/cri-tools"
VENDOR_PREFIX=
if [ -z "$(go mod why 2>/dev/null)" ]; then
VENDOR_PREFIX="${PKG}/vendor/"
fi
VERSIONFLAGS="
-X $PKG/pkg/version.Version=$VERSION
-X $PKG/pkg/version.GitCommit=${COMMIT:0:8}
-X $PKG_CONTAINERD/version.Version=$VERSION_CONTAINERD
-X $PKG_CONTAINERD/version.Package=$PKG_RANCHER_CONTAINERD
-X $PKG_CRICTL/pkg/version.Version=$VERSION_CRICTL"
-X ${PKG}/pkg/version.Version=${VERSION}
-X ${PKG}/pkg/version.GitCommit=${COMMIT:0:8}
-X ${VENDOR_PREFIX}${PKG_CONTAINERD}/version.Version=${VERSION_CONTAINERD}
-X ${VENDOR_PREFIX}${PKG_CONTAINERD}/version.Package=${PKG_RANCHER_CONTAINERD}
-X ${VENDOR_PREFIX}${PKG_CRICTL}/pkg/version.Version=${VERSION_CRICTL}"
LDFLAGS="
-w -s"
STATIC="