This file provides context and guidelines for AI assistants (LLMs) working on the Mau codebase.
Mau is a convention for building peer-to-peer (P2P) Web 2.0 applications. It provides:
Account (account.go)
golang.org/x/crypto/openpgpServer (server.go)
Client (client.go)
DHT/Kademlia (kademlia.go)
Friends (friend.go)
Error Handling
assert.NoError(t, err) in tests (testify/assert)_ unless explicitly justifiedTesting
github.com/stretchr/testify/assert for all assertionsif err != nil { t.Fatalf(...) } - use assert.NoErrorLinting
golangci-lint with zero errorsgolangci-lint run --timeout=5mDependencies
golang.org/x/crypto/openpgp (project dependency, properly marked with nolint directives)1account, err := NewAccount(dir, "Name", "email@example.com", "password")
2assert.NoError(t, err)
1var friendPub bytes.Buffer
2err := friendAccount.Export(&friendPub)
3assert.NoError(t, err)
4
5friend, err := account.AddFriend(&friendPub)
6assert.NoError(t, err)
7
8err = account.Follow(friend)
9assert.NoError(t, err)
1// Adding a file with recipients
2file, err := account.AddFile(reader, "filename.txt", []*Friend{friend})
3assert.NoError(t, err)
4
5// Private file (no recipients)
6file, err := account.AddFile(reader, "private.txt", []*Friend{})
7assert.NoError(t, err)
The project uses GitHub Actions:
.github/workflows/test.yml): Runs test suite with coverage.github/workflows/lint.yml): Runs golangci-lint (installed from source for Go 1.26 compatibility).github/workflows/xlog.yml): Builds documentation 1# Run all tests
2go test ./...
3
4# Run specific test
5go test -v -run TestName
6
7# Run linter
8golangci-lint run --timeout=5m
9
10# Run tests with coverage
11go test -coverprofile=coverage.out ./...
mau/
├── account.go # Account and PGP identity management
├── client.go # Client for downloading friend files
├── server.go # HTTPS server with mTLS
├── kademlia.go # DHT implementation
├── friend.go # Friend management
├── file.go # File operations
├── fingerprint.go # PGP fingerprint handling
├── resolvers.go # Peer discovery resolvers
├── cmd/mau/mau.go # CLI application
├── *_test.go # Test files
└── .github/workflows/ # CI/CD workflows
Files support versioning in .versions/ subdirectories, allowing rollback and history.
golangci-lint passesThis file is for AI assistants. For human contributors, see README.md and TODO.md.