Sunday, November 22, 2026
HomeGolangCode Assessment: NetDisk — self-hosted Go file server (chi, pgx, native/S3, NFS...

Code Assessment: NetDisk — self-hosted Go file server (chi, pgx, native/S3, NFS gateway) – Code Assessment


Hello everybody,

I’m comparatively new to Go (coming from a backend-leaning full-stack background) and simply pushed the primary public launch of NetDisk, a self-hosted file server I’ve been constructing:

To be upfront about the way it was constructed: I used AI coding instruments to assist scaffold the preliminary model and iterate on components of it, then went again by means of the core modules to audit safety boundaries, harden transactions, and clear up the construction earlier than placing it out right here. Now I’d actually admire blunt, idiomatic Go suggestions from skilled Gophers.

Fast overview of the stack

  • Router & HTTP: internet/http + chi/v5, embedded vanilla HTML/CSS/JS frontend (embed)
  • DB: PostgreSQL through pgx/v5 with uncooked SQL and embedded migrations
  • Storage: Native filesystem and S3-compatible (minio-go/v7) behind a shared storage.Storage interface
  • Options: Streaming multipart + chunked uploads, content-addressed blob deduplication & GC queue, Vary/206 downloads and safe-MIME previews, streaming folder ZIP downloads, P2P switch, and an experimental user-space NFS gateway (willscott/go-nfs + go-billy)

What I’d love critique on

When you’ve got a couple of minutes to poke round, these are the areas I’m least assured about:

  1. Bundle format & abstractions (cmd/server/most important.go, inner/): I break up issues into handler -> service -> repository -> storage. Does this really feel clear and idiomatic in Go, or unnecessarily heavy for a single-binary app of this dimension?
  2. Streaming I/O & cancellation (inner/storage/native.go, inner/handler/recordsdata.go, OpenZip in inner/service/recordsdata.go): Uploads stream by means of r.MultipartReader() into temp recordsdata with simultaneous SHA-256 hashing (io.MultiWriter) and atomic rename; folder downloads stream ZIPs over io.Pipe. Are there delicate goroutine leaks, backpressure points, or edge instances on shopper disconnect that I missed?
  3. Transactions & blob GC races (inner/service/recordsdata.go, inner/service/uploads.go): I lately moved the blob + node writes for add, prompt add, and chunked completion into single DB transactions, with failed object deletes queued for background retry. Does the boundary between gradual storage I/O and DB transactions look sound?
  4. Sleek shutdown & experimental NFS (cmd/server/most important.go, inner/nfsgateway/): Any apparent flaws in how background cleanup staff and the NFS server are wired into sign dealing with and shutdown?

Be happy to be direct—even small nitpicks on error dealing with, naming, or non-idiomatic patterns are tremendous useful. Thanks for looking!

A possible edge case within the ZIP path: on shopper disconnect, ensure the handler closes the reader aspect promptly and the producer treats any write error as terminal. If the producer can block on a pipe write whereas the buyer has already returned, that goroutine can leak. Even have the producer choose on the request context between chunks, and clear up temp recordsdata on each error path. A bounded semaphore round concurrent ZIP technology is price contemplating so a couple of gradual downloads can’t pin unbounded goroutines or CPU.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments