k3s/scripts/validate
Brad Davidson 2d313a6f72 Bump golangci-lint for go1.25
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-12-18 11:20:07 -08:00

46 lines
877 B
Bash
Executable file

#!/bin/bash
set -e
export GIT_PAGER=cat
if [ -n "$SKIP_VALIDATE" ]; then
echo Skipping validation
exit
fi
cd $(dirname $0)/..
echo Running: install script signature checks
sha256sum -c install.sh.sha256sum
echo Running: go mod tidy
go mod tidy
echo Running validation
. ./scripts/version.sh
if [ -n "$DIRTY" ]; then
echo Source dir is dirty
git status --porcelain --untracked-files=no
git diff
exit 1
fi
echo Running: go version
if ! go version | grep -s "go version ${VERSION_GOLANG} "; then
echo "Unexpected $(go version) - Kubernetes ${VERSION_K8S} should be built with go version ${VERSION_GOLANG}"
exit 1
fi
echo Running: go mod verify
go mod verify
if [ ! -e build/data ];then
mkdir -p build/data
fi
if [ -z "$SKIP_LINT" ] && command -v golangci-lint; then
echo Running: golangci-lint
golangci-lint run --timeout=5m
fi