-
Notifications
You must be signed in to change notification settings - Fork 262
Fix compilation of pkg/archive tests on non-Linux #2246
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 compilation of pkg/archive tests on non-Linux #2246
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nalind The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
77768b6
to
0427b27
Compare
17b2f22
to
d59ef59
Compare
LGTM |
d59ef59
to
4af591e
Compare
pkg/archive/changes_unix_test.go
Outdated
//go:build !windows | ||
|
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.
Strictly speaking,
- it should be
unix
rather than!windows
(otherwise it won't work on e.g. plan9). - the build tag is redundant as we have
_unix_test.go
in the file name (supported since Go 1.19)
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.
I'll have to remember that. Thanks!
pkg/archive/changes_unix_test.go
Outdated
"golang.org/x/sys/unix" | ||
) | ||
|
||
// resetSymlinkTimesLinux sets the atime and mtime of a symlink to a known value, to test |
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.
// resetSymlinkTimesLinux sets the atime and mtime of a symlink to a known value, to test | |
// resetSymlinkTimes sets the atime and mtime of a symlink to a known value, to test |
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.
Oof, shoulda caught that. Thanks!
// resetSymlinkTimesLinux sets the atime and mtime of a symlink to a known value, to test | ||
// whether changes to the symlink target are detected correctly. | ||
func resetSymlinkTimesLinux(path string) error { | ||
if runtime.GOOS != linux { |
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.
nit: with that, const linux
in archive.go (introduced by commit f5c1ad9) is now unused.
Unixy systems all have Lutimes(), and this code should have been stubbed out for non-Unixy systems. h/t @kolyshkin Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
4af591e
to
cd5ef3f
Compare
/lgtm |
Unixy systems have Lutimes(), and we should have stubbed it out for non-Unixy systems.