Skip to content

Commit

Permalink
Fix some govet linter warnings
Browse files Browse the repository at this point in the history
govet warned about some places where we were passing something other
than a literal string to a function that took format specifiers.

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed Aug 15, 2024
1 parent 8ae9912 commit 72647cc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions chroot/run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ func setupChrootBindMounts(spec *specs.Spec, bundlePath string) (undoBinds func(
if err := unix.Mount(m.Mountpoint, subSys, "bind", sysFlags, ""); err != nil {
msg := fmt.Sprintf("could not bind mount %q, skipping: %v", m.Mountpoint, err)
if strings.HasPrefix(m.Mountpoint, "/sys") {
logrus.Infof(msg)
logrus.Info(msg)
} else {
logrus.Warningf(msg)
logrus.Warning(msg)
}
continue
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/buildah/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func init() {
var defaultStoreDriverOptions []string
storageOptions, err := storage.DefaultStoreOptions()
if err != nil {
logrus.Errorf(err.Error())
logrus.Error(err.Error())
os.Exit(1)

}
Expand All @@ -80,7 +80,7 @@ func init() {

defaultContainerConfig, err = config.Default()
if err != nil {
logrus.Errorf(err.Error())
logrus.Error(err.Error())
os.Exit(1)
}
defaultContainerConfig.CheckCgroupsAndAdjustConfig()
Expand Down
12 changes: 6 additions & 6 deletions imagebuildah/stage_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,20 +904,20 @@ func (s *StageExecutor) UnrecognizedInstruction(step *imagebuilder.Step) error {
errStr := fmt.Sprintf("Build error: Unknown instruction: %q ", strings.ToUpper(step.Command))
err := fmt.Sprintf(errStr+"%#v", step)
if s.executor.ignoreUnrecognizedInstructions {
logrus.Debugf(err)
logrus.Debug(err)
return nil
}

switch logrus.GetLevel() {
case logrus.ErrorLevel:
s.executor.logger.Errorf(errStr)
s.executor.logger.Error(errStr)
case logrus.DebugLevel:
logrus.Debugf(err)
logrus.Debug(err)
default:
s.executor.logger.Errorf("+(UNHANDLED LOGLEVEL) %#v", step)
}

return fmt.Errorf(err)
return errors.New(err)
}

// prepare creates a working container based on the specified image, or if one
Expand Down Expand Up @@ -1223,9 +1223,9 @@ func (s *StageExecutor) Execute(ctx context.Context, base string) (imgID string,
if output != "" {
commitMessage = fmt.Sprintf("%s %s", commitMessage, output)
}
logrus.Debugf(commitMessage)
logrus.Debug(commitMessage)
if !s.executor.quiet {
s.log(commitMessage)
s.log("%s", commitMessage)
}
}
// logCachePulled produces build log for cases when `--cache-from`
Expand Down
2 changes: 1 addition & 1 deletion run_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,7 @@ func (b *Builder) cleanupTempVolumes() {
for tempVolume, val := range b.TempVolumes {
if val {
if err := overlay.RemoveTemp(tempVolume); err != nil {
b.Logger.Errorf(err.Error())
b.Logger.Error(err.Error())
}
b.TempVolumes[tempVolume] = false
}
Expand Down

0 comments on commit 72647cc

Please sign in to comment.