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
x/sys/unix: Stat_t.Atim is named Atimespec on darwin #31735
Comments
@tklauser, @ianlancetaylor, IIRC this is named differently in x/sys/unix because it was in syscall? Is that enough of an argument? Renaming it would break more people, though. I think the best option would probably be to add some accessors methods (both get & set) for those fields that are portable. |
The names in the syscall package vary on various systems. js, nacl: two fields: The names in the x/sys/unix package also vary, and are slightly different: aix: freebsd/386 also has an These are all of course a result of different paths that the operating systems have taken to expand the traditional Since the fields in x/sys/unix are all type |
I'd support a breaking change if you do. People using modules wouldn't get a surprise break until an update anyway. |
I'd be fine with a breaking change as well. FWIW, we already did the |
We've reverted syscall back to |
@paulzhol, std/syscall has stricter compatibility rules, though. We can do more cleanups in x/sys/unix. |
@bradfitz it should be Also I was under the assumption that with the syscall freeze, x/sys/unix would be a replacement which would allow more rapid changes independent of the standard compiler and library. Not to provide a unified low-level view of all unix systems. |
Yes, |
Change https://golang.org/cl/175037 mentions this issue: |
Here's the other option of adding accessors instead of renaming fields: https://go-review.googlesource.com/c/sys/+/175037 Thoughts? |
Can we pre-process |
Nice. Now that I see how straightforward the implementation is, I slightly prefer this to renaming the fields. I think it is less brittle than some preprocessor magic and/or ugly regex based postprocessing in mkpost.go. Also, this would in principle be backportable to package |
Change https://golang.org/cl/175157 mentions this issue: |
The rename version is at https://golang.org/cl/175157. Please run the try bots I'm sure stuff are broken. |
TryBots seem happy but they wont test on many of the affected geese (e.g. most BSDs, solaris, aix). |
I also think the accessors CL is elegant, but we already have two versions of it due to syscall differences: https://github.com/golang/go/blob/master/src/os/stat_unix.go and https://github.com/golang/go/blob/master/src/archive/tar/stat_unix.go |
@paulzhol, we can ignore std for the purpose of deciding x/sys's API. If anything, perhaps we can even make std use x/sys/unix instead of std's syscall. Russ said he didn't want two syscall packages in std, but he never said the one couldn't be x/sys/unix. So perhaps we clean up x/sys/unix and then switch std to using it. |
Let's rename the fields to the names used on GNU/Linux. |
Change https://golang.org/cl/177437 mentions this issue: |
Following CL 175157 which renames Stat_t time fields to [AMCB]tim. Updates golang/go#31735 Change-Id: I0791c59bab307d237b315c1b919265902f7d9917 Reviewed-on: https://go-review.googlesource.com/c/sys/+/177437 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
cat test.go
linux
output
darwin
output
What did you expect to see?
Mac platform is the same as linux output
What did you see instead?
Mac platform error
The text was updated successfully, but these errors were encountered: