Browse Source

Use vendor prefix for versions if not using go mod

pull/1000/head
Erik Wilson 5 years ago
parent
commit
01707ce451
  1. 14
      scripts/build

14
scripts/build

@ -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="

Loading…
Cancel
Save