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:
parent
9ad9ecfa05
commit
1ad014e71c
1 changed files with 3 additions and 3 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue