Skip to content

Commit

Permalink
Merge pull request #26 from bbkane:git-xargs/sync-golang-ci-lint
Browse files Browse the repository at this point in the history
Add goimports
  • Loading branch information
bbkane authored Dec 11, 2023
2 parents 52e2720 + 7b3f2c2 commit a74dc6d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 1 addition & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ linters:
- gochecknoglobals
- gochecknoinits
- gofmt
- goimports
- nonamedreturns
- predeclared
fast: false
linters-settings:
errcheck:
exclude-functions:
- (*go.bbkane.com/logos.Logger).Sync
6 changes: 5 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func editConfig(ctx command.Context) error {

zapLogger := logos.NewBBKaneZapLogger(lumberJackLogger, zap.DebugLevel, version)
logger := logos.New(zapLogger, color)
defer logger.Sync()
logger.LogOnPanic()

configPath, configPathExists := ctx.Flags["--config"].(string)
Expand All @@ -59,5 +58,10 @@ func editConfig(ctx command.Context) error {
)
return err
}

err = logger.Sync()
if err != nil {
return fmt.Errorf("could not sync logger: %w", err)
}
return nil
}
7 changes: 6 additions & 1 deletion grab.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ func grab(ctx command.Context) error {

zapLogger := logos.NewBBKaneZapLogger(lumberJackLogger, zap.DebugLevel, version)
logger := logos.New(zapLogger, color)
defer logger.Sync()
logger.LogOnPanic()

subredditDestinations := ctx.Flags["--subreddit-destination"].([]string)
Expand Down Expand Up @@ -430,5 +429,11 @@ func grab(ctx command.Context) error {

grabSubreddit(timeoutCtx, logger, sr, posts)
}

err = logger.Sync()
if err != nil {
return fmt.Errorf("could not sync logger: %w", err)
}

return nil
}

0 comments on commit a74dc6d

Please sign in to comment.