Files
2026-03-05 22:29:31 +03:00

52 lines
1.2 KiB
Python
Executable File

#!/bin/bash
export GOPATH="${HOME}/src/rspamd-cgp"
VERSION=$(git describe --tags --always 2>/dev/null || echo "manual")
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
# Путь к пакету, где лежат переменные
PKG="git.vsu.ru/ai/rspamd-cgp/config"
LDFLAGS="-X '$PKG.Version=$VERSION' -X '$PKG.Commit=$COMMIT' -X '$PKG.BuildTime=$BUILD_TIME'"
export CGO_ENABLED=0
case "$1" in
"fmt")
go fmt ./...
;;
"fix")
go fix -diff ./...
;;
"test")
go test -v ./...
;;
"test-one")
go test -v -run "$2"
;;
"bench")
go test -bench=. -benchmem -run=^#
;;
"pprof")
go test -cpu=1 -bench=BenchmarkRspamc_Scan_RealWork -benchmem -memprofile mem.out -cpuprofile cpu.out
;;
"tidy")
go mod tidy
;;
"update")
echo "Updating dependencies..."
go get -u ./...
go mod tidy
;;
"vet")
echo "Running static analysis..."
go vet ./...
;;
*)
echo "Building version $VERSION..."
go build -ldflags="$LDFLAGS" -o rspamd-cgp
;;
esac