-
Notifications
You must be signed in to change notification settings - Fork 247
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 golangci-lint warnings #1149
Conversation
50ba928
to
526e8a1
Compare
internal/exec/engine.go
Outdated
@@ -91,6 +91,7 @@ func (e Engine) Run(stageName string) error { | |||
systemBaseConfig, r, err := system.FetchBaseConfig(e.Logger, e.PlatformConfig.Name()) | |||
e.logReport(r) | |||
if err != nil && err != providers.ErrNoProvider { | |||
//nolint:errcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, let's discuss this one OOB.
tests/filesystem.go
Outdated
@@ -224,6 +224,7 @@ func setupDisk(ctx context.Context, disk *types.Disk, diskIndex int, imageSize i | |||
loopdev := disk.Device | |||
defer func() { | |||
if err != nil { | |||
//nolint:errcheck | |||
destroyDevice(loopdev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does something like _ = destroyDevice(loopdev)
satisfy the linter? That might be cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the linter doesn't complain after this change.
internal/exec/stages/disks/luks.go
Outdated
@@ -110,7 +110,9 @@ func (s *stage) createLuks(config types.Config) error { | |||
var ignitionCreatedKeyFile bool | |||
// create keyfile inside of tmpfs, it will be copied to the | |||
// sysroot by the files stage | |||
os.MkdirAll(distro.LuksInitramfsKeyFilePath(), 0700) | |||
if err := os.MkdirAll(distro.LuksInitramfsKeyFilePath(), 0700); err != nil { | |||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The surrounding code wraps errors before returning them, so we should do that here too.
internal/exec/util/passwd.go
Outdated
"IGNITION_USER_NAME": c.Name, | ||
"IGNITION_PATH": path, | ||
"MESSAGE_ID": ignitionSSHAuthorizedkeysMessageID, | ||
}) | ||
}); err != nil { | ||
return err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, should be wrapped. Though I'm not sure we should consider it a fatal error if we can't log a journal message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this one?
_ = journal.Send(fmt.Sprintf("wrote ssh authorized keys file for user: %s", c.Name), journal.PriInfo, map[string]string{
"IGNITION_USER_NAME": c.Name,
"IGNITION_PATH": path,
"MESSAGE_ID": ignitionSSHAuthorizedkeysMessageID,
})
19dcb42
to
8734677
Compare
6f56b12
to
6ed3271
Compare
6ed3271
to
00d13b9
Compare
00d13b9
to
25dec22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM generally.
25dec22
to
8fa7bf9
Compare
When `wipeTable` is enabled, we run `sgdisk --zap-all`. But if the table was corrupted in the first place, `sgdisk` will exit with code 2 which then breaks boot. As a workaround, Ignition used to retry the invocation but the context around it was lost in coreos#544 and coreos#1149 and the retry was removed and the error-checking was added. So this patch effectively re-applies 94c98bc ("sgdisk: retry zap-all operation on failure"), but now with a comment and a test to make sure we don't regress again. Closes: coreos/fedora-coreos-tracker#1596
When `wipeTable` is enabled, we run `sgdisk --zap-all`. But if the table was corrupted in the first place, `sgdisk` will exit with code 2 which then breaks boot. As a workaround, Ignition used to retry the invocation but the context around it was lost in coreos#544 and coreos#1149 and the retry was removed and the error-checking was added. So this patch effectively re-applies 94c98bc ("sgdisk: retry zap-all operation on failure"), but now with a comment and a test to make sure we don't regress again. Closes: coreos/fedora-coreos-tracker#1596
When `wipeTable` is enabled, we run `sgdisk --zap-all`. But if the table was corrupted in the first place, `sgdisk` will exit with code 2 which then breaks boot. As a workaround, Ignition used to retry the invocation but the context around it was lost in coreos#544 and coreos#1149 and the retry was removed and the error-checking was added. So this patch effectively re-applies 94c98bc ("sgdisk: retry zap-all operation on failure"), but now with a comment and a test to make sure we don't regress again. Closes: coreos/fedora-coreos-tracker#1596
Fixes part of #1121
Addresses the following warnings:
https://gist.github.com/sohankunkerkar/e7a8a97be039283d841db527acd7d360
And a few more
errcheck
warnings which are not covered in this gist, but appeared in an ad-hoc manner while trying to fix these warnings.