LinkedGram is a small Go social-domain project with posts, comments, profiles, follow relationships, news feeds, and file-backed persistence. The repository was reconstructed from a set of conflicting standalone translations into one buildable Go module.
- Go 1.22 or newer
go run ./cmd/linkedgramThe demo creates a post, adds a comment, and renders a news feed. The reusable
domain API lives in the root linkedgram package.
go test ./...
go test -race -cover ./...
go vet ./...CI runs formatting, vet, race-enabled tests, and coverage on every push and pull request.
post.go: post/comment validation, voting, and visibilitynewsfeed.go: concurrent-safe feed add, lookup, removal, and filteringprofile.go: validated profiles and atomic JSON decodinguser.go: user identity, profiles, and bidirectional follow relationshipspost_store.go: JSON Lines post persistence with strict decode errors and a 1 MiB maximum per recordcredential_store.go: registration and authentication with bcrypt-hashed credentials and atomic file replacementcmd/linkedgram: one executable demo entry point
Runtime data is intentionally excluded from Git. Sample post and credential
formats are available in examples/.
PostStore accepts records up to MaxPostRecordBytes (1 MiB), including
records larger than the 64 KiB default scanner limit. It rejects oversized
records before opening a file for append, so a failed save cannot create or
change the store. The tracked examples/posts.jsonl file is a valid post-store
sample.
Credential files contain only versioned bcrypt hashes and are written with
owner-only permissions. The reconstructed application deliberately rejects the
legacy username:plaintext-password format; reset those passwords rather than
importing or attempting to migrate reversible secrets.
User objects never receive, store, or compare passwords. Create domain users
with NewUser(username) and keep registration and authentication exclusively
in CredentialStore.Add and CredentialStore.Authenticate.
The original repository stored 32 conflicting Go files and one Java/JUnit test
artifact together. They duplicated types and entry points, so the package could
not compile. Byte-for-byte snapshots are preserved with .txt appended under
legacy/original-source-archive/; the suffix intentionally keeps them out of
the Go build graph and must not be removed. Unused GUI images, historical
Python requirements, and IDE metadata are also preserved under legacy/.