Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correctly format logged errors during arg parsing #132

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions cmd/scip-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ func main() {
}

func mainErr() error {
// The default formatting also prints the date, which is generally not needed.
log.SetTimeFormat("15:04:05")
log.SetStyles(func() *log.Styles {
// The default styles will print 'DEBU' and 'ERRO' to line
// up with 'INFO' and 'WARN', instead of 'DEBUG' and 'ERROR'
s := log.DefaultStyles()
for lvl, style := range s.Levels {
s.Levels[lvl] = style.UnsetMaxWidth()
}
return s
}())

if err := parseArgs(os.Args[1:]); err != nil {
return err
}
Expand All @@ -108,17 +120,6 @@ func mainErr() error {
handler.SetDev(devMode)

output.SetOutputOptions(getVerbosity(), animation)
// The default formatting also prints the date, which is generally not needed.
log.SetTimeFormat("15:04:05")
log.SetStyles(func() *log.Styles {
// The default styles will print 'DEBU' and 'ERRO' to line
// up with 'INFO' and 'WARN', instead of 'DEBUG' and 'ERROR'
s := log.DefaultStyles()
for lvl, style := range s.Levels {
s.Levels[lvl] = style.UnsetMaxWidth()
}
return s
}())

modulePath, isStdLib, err := modules.ModuleName(moduleRoot, repositoryRemote, moduleName)

Expand Down
Loading