Nits#2325
Merged
Merged
Conversation
In many places (not all of them though) we can use `unix.` instead of `syscall.` as these are indentical. In particular, x/sys/unix defines: ```go type Signal = syscall.Signal type Errno = syscall.Errno type SysProcAttr = syscall.SysProcAttr const ENODEV = syscall.Errno(0x13) ``` and unix.Exec() calls syscall.Exec(). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This is a forgotten hunk from PR opencontainers#2291. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
kolyshkin
commented
Apr 18, 2020
kolyshkin
commented
Apr 18, 2020
| for { | ||
| err := ioutil.WriteFile(filename, data, perm) | ||
| if isInterruptedWriteFile(err) { | ||
| if errors.Is(err, unix.EINTR) { |
Contributor
Author
There was a problem hiding this comment.
Tested using go 1.14.2:
=== RUN TestWriteCgroupFileHandlesInterrupt
INFO[0000] interrupted while writing 1112067 to /sys/fs/cgroup/memory/test-eint-651408428/memory.limit_in_bytes
--- PASS: TestWriteCgroupFileHandlesInterrupt (0.75s)
=== RUN TestGetCgroupParamsInt
--- PASS: TestGetCgroupParamsInt (0.00s)
PASS
Member
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A few nitpicks to simplify the code.
1. Do not use
syscallpackage whereunixcan be used.In many places (not all of them though) we can use
unix.instead of
syscall.as these are indentical.In particular, x/sys/unix defines:
and unix.Exec() calls syscall.Exec().
2. Use
errors.Is()to check for EINTR.This is a forgotten hunk from PR #2291.