Hacker News new | ask | show | jobs
by hnlmorg 1645 days ago
Sorry I should have been more specific. I mean the os file struct https://pkg.go.dev/os#File

The os package makes use of a *File struct rather than an interface. The authors acknowledged this was a mistake but it's some of the oldest code in Go and Go's backwards compatibility guarantee has meant that they cannot fix that.

Since I author a $SHELL written in Go, being able to add in my own *File methods would have allowed me to add in some cool features. But I've found workarounds in most cases. It's just not as clean code as it could have been.

1 comments

What I am saying is, there is already an interface, which os.File should be implementing.
And what I'm saying is that interface was created after os.File was created and after go 1.0 was released thus that change now cannot happen without breaking the backward compatibility guarantee. Hence my point about go v2.0