Skip to content
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

Example https://golang.org/pkg/mime/multipart/#example_NewReader doesn't build #44568

Closed
tnerolftnerolf opened this issue Feb 24, 2021 · 2 comments

Comments

@tnerolftnerolf
Copy link

What version of Go are you using (go version)?

Expected version is 1.16, but it appears that the Go version running the example is 1.15.8.

Does this issue reproduce with the latest release?

With the latest available multipart package documentation available on internet as of 24/02/2021 9:35 am CET, yes.

What operating system and processor architecture are you using (go env)?

Not applicable

What did you do?

I tried to run the example https://golang.org/pkg/mime/multipart/#example_NewReader.

What did you expect to see?

A running exemple.

What did you see instead?

A compiler error ./prog.go:37:18: undefined: io.ReadAll

Analysis

The example is modified to use io.ReadAll introduced in Go 1.16 to replace the one from deprecated package io/ioutil.

However, the compiler used to run the example is still Go 1.15.8, as shown by using runtime.Version(), not not supporting io.ReadAll().

@tnerolftnerolf tnerolftnerolf changed the title Exemple https://golang.org/pkg/mime/multipart/#example_NewReader doesn't build Example https://golang.org/pkg/mime/multipart/#example_NewReader doesn't build Feb 24, 2021
@tmthrgd
Copy link
Contributor

tmthrgd commented Feb 24, 2021

This is a duplicate of #44389.

@seankhliao
Copy link
Member

Duplicate of #44389

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants