Skip to content

Commit

Permalink
Fix last linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
upils committed Sep 20, 2023
1 parent 361d529 commit 35d2c56
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/commands/classic.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ type ClassicArgs struct {
// ClassicOpts holds all flags that are specific to the classic command
type ClassicOpts struct {
AptParams []string `long:"apt-params" description:"Any additional APT specific configuration needed for the image build."` // TODO: is this used?
}
}
1 change: 1 addition & 0 deletions internal/statemachine/classic_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@ func (stateMachine *StateMachine) preseedClassicImage() error {
// assemble the commands in the correct order: mount, preseed, unmount
preseedCmds = append(preseedCmds, mountCmds...)
preseedCmds = append(preseedCmds,
//nolint:gosec,G204
exec.Command("/usr/lib/snapd/snap-preseed", stateMachine.tempDirs.chroot),
)
preseedCmds = append(preseedCmds, umountCmds...)
Expand Down
10 changes: 9 additions & 1 deletion internal/statemachine/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,15 @@ func (stateMachine *StateMachine) updateGrub(rootfsVolName string, rootfsPartNum
"--detach",
loopUsed,
)
defer teardownCmd.Run()
defer func() {
if tmpErr := teardownCmd.Run(); tmpErr != nil {
if err != nil {
err = fmt.Errorf("%s after previous error: %w", tmpErr, err)
} else {
err = tmpErr
}
}
}()
updateGrubCmds = append(updateGrubCmds, teardownCmd)

// now run all the commands
Expand Down

0 comments on commit 35d2c56

Please sign in to comment.