Can we "go get" unreleased standard library packages?

175 views
Skip to first unread message

Matt Mueller

unread,
Dec 2, 2020, 6:31:02 PM12/2/20
to golang-nuts
Hey there, I'd like to try the io/fs package on Go 1.15. Is there an easy way to do this?

I tried without much expectation:


But was greeted with this error:

go: found github.com/golang/go/src/io/fs in github.com/golang/go/src v0.0.0-20201202201757-2d0258d49568
        module declares its path as: std
                but was required as: github.com/golang/go/src

Any ideas? Thanks!

Axel Wagner

unread,
Dec 2, 2020, 7:10:51 PM12/2/20
to Matt Mueller, golang-nuts
No, that's not really possible. The stdlib is packaged with the Go compiler and is very interdependent.
It also wouldn't help you a lot, because in go1.15, the `io/fs` package has no implementation yet. For example, (*os.File).Stat does not return the correct type, compare
with

If you want to experiment, you have to use a go version compiled from tip. You can already develop against it, if you use build tags to guard on go1.16 (though keep in mind that the interfaces could, theoretically, still change).

Otherwise you just have to wait for go1.16. A beta should be released soon (probably next week, AIUI).


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8857da92-774a-453b-9c81-46bf818b38b6n%40googlegroups.com.

Matt Mueller

unread,
Dec 2, 2020, 8:08:14 PM12/2/20
to golang-nuts
Ah, that's a great point. Thanks for taking the time to explain it!

I'll wait for the beta then – thanks!

Kostarev Ilya

unread,
Dec 2, 2020, 8:11:32 PM12/2/20
to golang-nuts
$ git checkout master
in source tree provide me `io/fs`

Kevin Chowski

unread,
Dec 4, 2020, 4:52:41 PM12/4/20
to golang-nuts
To follow up on Axel's suggestion to use "tip", this tool will automatically download the latest repository and compile it for you, with just two simple commands (download/compile the tool with go get, then run the tool): https://godoc.org/golang.org/dl/gotip

I used it the other week and I was quite impressed with how smooth it was!

Reply all
Reply to author
Forward
0 new messages