Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: os: add Lchtimes to change only a symlink's times without following it #30487
Looks like there's no way to change access and modification times of a symlink.
Since there is os.Chown and os.Lchown to change the uid and gid, I think there should also be Lchtimes. The implementation can be similar to the one of os.Chtimes. (E. g. on linux only the flag AT_SYMLINK_NOFOLLOW has to be added.)
Thank you for the feature request @Isolus and welcome to the Go project!
But isn't it a little unintuitive that Lstat (the no follow companion) to Stat is included in the os package. Therefore I can retrieve the times with the os package, but I can't write them?
I'm currently adding tar archiver functionality to an application and everything but a Lchtimes (or Lutimes) function for symlink handling (i. e. Lchmod and Lstat) is there (in the standard library). So my first thought was that this function was just forgotten.
Add Lutimes wrapping UtimesNanoAt. Updates golang/go#30487 Change-Id: Ic5bb3b4d88be5806522eaef9bd9b8b0f5c1c8f42 Reviewed-on: https://go-review.googlesource.com/c/sys/+/164662 Run-TryBot: Tobias Klauser <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org>