Skip to content

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

@tnerolftnerolf

Description

@tnerolftnerolf

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().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions