20 lines
504 B
Bash
20 lines
504 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
bash "$root/scripts/check-env.sh"
|
|
|
|
cd "$root"
|
|
mkdir -p bin
|
|
unformatted="$(gofmt -l cmd internal)"
|
|
if [[ -n "$unformatted" ]]; then
|
|
echo '以下 Go 文件尚未格式化:' >&2
|
|
echo "$unformatted" >&2
|
|
exit 1
|
|
fi
|
|
go list -mod=readonly ./... >/dev/null
|
|
CGO_ENABLED=1 go test ./...
|
|
CGO_ENABLED=1 go build -tags cshared -buildmode=c-shared -o bin/billing.so ./cmd/billing
|
|
|
|
echo "Built: $root/bin/billing.so"
|