ax(mining): replace prose comments with usage examples in repository.go

Three comments on Path, Exists, and Delete restated what the signatures
already convey. Replaced with concrete call examples per AX Principle 2.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 09:04:34 +01:00
parent 9ad9ecfa05
commit 1ad014e71c
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -133,12 +133,12 @@ func (r *FileRepository[T]) Update(fn func(*T) error) error {
return r.saveUnlocked(data)
}
// Path returns the file path of this repository.
// path := repo.Path() // => "/home/user/.config/lethean-desktop/miners.json"
func (r *FileRepository[T]) Path() string {
return r.path
}
// Exists returns true if the repository file exists.
// if !repo.Exists() { return defaults, nil }
func (r *FileRepository[T]) Exists() bool {
r.mu.RLock()
defer r.mu.RUnlock()
@ -147,7 +147,7 @@ func (r *FileRepository[T]) Exists() bool {
return err == nil
}
// Delete removes the repository file.
// if err := repo.Delete(); err != nil { return err }
func (r *FileRepository[T]) Delete() error {
r.mu.Lock()
defer r.mu.Unlock()