Files
chat/Makefile
clawbot fd86a774ae
All checks were successful
check / check (push) Successful in 5s
fix: change appname to neoirc and default DB to /var/lib/neoirc/state.db
- Change Appname from "chat" to "neoirc" in cmd/chatd/main.go
- Change default DBURL from file:./data.db to file:///var/lib/neoirc/state.db
  in both internal/config/config.go and internal/db/db.go fallback
- Create /var/lib/neoirc/ directory in Dockerfile with proper ownership
- Update README.md to reflect new defaults (DBURL, docker run example,
  SQLite backup/location docs)
- Remove stale data.db reference from Makefile clean target

The DB path remains configurable via DBURL environment variable.

Closes #44
2026-03-06 03:35:47 -08:00

50 lines
1.3 KiB
Makefile

.PHONY: all build lint fmt fmt-check test check clean run debug docker hooks
BINARY := chatd
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILDARCH := $(shell go env GOARCH)
LDFLAGS := -X main.Version=$(VERSION) -X main.Buildarch=$(BUILDARCH)
all: check build
build:
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/chatd
lint:
golangci-lint run --config .golangci.yml ./...
fmt:
gofmt -s -w .
goimports -w .
fmt-check:
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
test:
go test -timeout 30s -v -race -cover ./...
# check runs all validation without making changes
# Used by CI and Docker build — fails if anything is wrong
check: test lint fmt-check
@echo "==> Building..."
go build -ldflags "$(LDFLAGS)" -o /dev/null ./cmd/chatd
@echo "==> All checks passed!"
run: build
./bin/$(BINARY)
debug: build
DEBUG=1 GOTRACEBACK=all ./bin/$(BINARY)
clean:
rm -rf bin/ chatd
docker:
docker build -t chat .
hooks:
@printf '#!/bin/sh\nset -e\n' > .git/hooks/pre-commit
@printf 'go mod tidy\ngo fmt ./...\ngit diff --exit-code -- go.mod go.sum || { echo "go mod tidy changed files; please stage and retry"; exit 1; }\n' >> .git/hooks/pre-commit
@printf 'make check\n' >> .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit