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:
16
main.go
16
main.go
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user