Add golangci-lint config and lint tasks

- Add .golangci.yml with sensible defaults for the project
- Add lint and lint:fix tasks to Taskfile
- Remove unused findGitRoot function
- Apply gofumpt formatting fixes
This commit is contained in:
2025-12-18 05:56:11 +01:00
parent 1cca87af90
commit 4773460f3f
3 changed files with 76 additions and 14 deletions

16
main.go
View File

@ -105,7 +105,8 @@ func formatContextInfo(contextSize int, usage *struct {
InputTokens int `json:"input_tokens"`
CacheCreationTokens int `json:"cache_creation_input_tokens"`
CacheReadInputTokens int `json:"cache_read_input_tokens"`
}) string {
},
) string {
totalK := contextSize / 1000
if usage == nil {
@ -177,19 +178,6 @@ func getGitInfo(cwd string) string {
return fmt.Sprintf(" git:(%s)", branch)
}
func findGitRoot(path string) string {
for {
if _, err := os.Stat(filepath.Join(path, ".git")); err == nil {
return path
}
parent := filepath.Dir(path)
if parent == path {
return ""
}
path = parent
}
}
func getTerminalWidth() int {
ws, err := unix.IoctlGetWinsize(int(os.Stdout.Fd()), unix.TIOCGWINSZ)
if err != nil {