mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 03:03:32 +01:00
chore: housekeeping and refactoring (bump to 4.7.1)
- Remove unused parameters, dead files, and inaccurate doc.go files - Extract shared helpers, eliminate duplication - Rename cheatpath.Cheatpath to cheatpath.Path - Optimize filesystem walks (WalkDir, skip .git) - Move sheet name validation to sheet.Validate - Move integration tests to test/integration/ - Consolidate internal/mock into mocks/ - Move fuzz.sh to test/ - Inline loadSheets helper into command callers - Extract config.New into its own file - Fix stale references in HACKING.md and CLAUDE.md - Restore plan9 build target - Remove redundant and low-value tests - Clean up project documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
23
mocks/path.go
Normal file
23
mocks/path.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Package mocks provides test fixture data and helpers for unit tests.
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Path returns the absolute path to the specified mock file within
|
||||
// the mocks/ directory.
|
||||
func Path(filename string) string {
|
||||
_, thisfile, _, _ := runtime.Caller(0)
|
||||
|
||||
file, err := filepath.Abs(
|
||||
filepath.Join(filepath.Dir(thisfile), filename),
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to resolve mock path: %v", err))
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
Reference in New Issue
Block a user