mirror of
https://github.com/hanzoai/team-go.git
synced 2026-10-30 20:22:42 +00:00
The Go transactor and account service for Hanzo Team. History starts here. The previous 107 commits carried the fork's origin in their messages and their tree, and none of it described this code: the Go under pkg/transactor is Hanzo's own work implementing a wire protocol, not a port of anyone's implementation. pkg/transactor/model.json remains, and remains attributed. It is a compiled platform model this transactor loads through go:embed, governed by EPL-2.0 and named in NOTICE. Removing it is a replacement project -- a new compiler and a move off the protocol -- not a deletion.
57 lines
1.5 KiB
Makefile
57 lines
1.5 KiB
Makefile
SHELL := /usr/bin/env bash
|
|
BIN := team
|
|
PKG := github.com/hanzoai/team/cmd/team
|
|
|
|
# Goa CLI provides the TS→JS transpiler. Install via:
|
|
# go install github.com/<your-org>/goa/cmd/goa@latest
|
|
GOA ?= goa
|
|
|
|
.PHONY: build dev run test fmt lint tidy functions clean docker
|
|
|
|
build: functions
|
|
CGO_ENABLED=0 go build -ldflags="-s -w" -o $(BIN) $(PKG)
|
|
|
|
# Local dev: file-watcher reloads .fn.ts changes via jsvm HooksWatch.
|
|
dev: functions
|
|
go run $(PKG) serve --dev --http :8080
|
|
|
|
run: build
|
|
./$(BIN) serve --http :8080
|
|
|
|
# Transpile every functions/*.fn.ts → functions/dist/*.js for Goja.
|
|
functions:
|
|
@mkdir -p functions/dist
|
|
@if command -v $(GOA) >/dev/null; then \
|
|
$(GOA) build --functions-dir ./functions --migrations-dir ./migrations; \
|
|
else \
|
|
echo "goa not installed; falling back to npx esbuild"; \
|
|
npx --yes esbuild --bundle --format=cjs --target=es2015 --platform=neutral \
|
|
--outdir=functions/dist --out-extension:.js=.js \
|
|
functions/*.fn.ts; \
|
|
fi
|
|
|
|
# -race needs cgo, and a cgo build only has SQLite's math functions behind
|
|
# csqlite's sqlite_math_functions tag — base makes the mismatch a compile
|
|
# error rather than a search that 500s only under cgo. The product itself
|
|
# ships CGO_ENABLED=0 (see Dockerfile), which always has them.
|
|
test:
|
|
go test -race -cover -tags sqlite_math_functions ./...
|
|
|
|
fmt:
|
|
gofmt -w .
|
|
goimports -w . 2>/dev/null || true
|
|
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
clean:
|
|
rm -rf $(BIN) functions/dist
|
|
|
|
docker:
|
|
docker build -t ghcr.io/hanzoai/team:dev .
|
|
|
|
.DEFAULT_GOAL := build
|