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

cmd/go: unexpected output with go doc std #53446

Open
ronaldpetty opened this issue Jun 18, 2022 · 4 comments
Open

cmd/go: unexpected output with go doc std #53446

ronaldpetty opened this issue Jun 18, 2022 · 4 comments
Labels
GoCommand cmd/go help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ronaldpetty
Copy link

go version go1.19beta1 linux/amd64

$ go version
go version go1.19beta1 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

Originally, I was attempting list all standard packages via go list std. I tried to find documentation go help list that confirms the use of "std" as some kind of proxy for listing the standard library. That led me to go doc std.

What did you expect to see?

I expected to see nothing (as its not a package) , or some kind of magic placeholder, or some kind of invalid package error.

What did you see instead?

What I think I see is the first standard library package in alpha order, archive/tar.

~$ go doc std
package tar // import "archive/tar"

Package tar implements access to tar archives.

Tape archives (tar) are a file format for storing a sequence of files that
can be read and written in a streaming manner. This package aims to cover most
variations of the format, including those produced by GNU and BSD tar tools.

const TypeReg = '0' ...
var ErrHeader = errors.New("archive/tar: invalid tar header") ...
type Format int
    const FormatUnknown Format ...
type Header struct{ ... }
    func FileInfoHeader(fi fs.FileInfo, link string) (*Header, error)
type Reader struct{ ... }
    func NewReader(r io.Reader) *Reader
type Writer struct{ ... }
    func NewWriter(w io.Writer) *Writer

Maybe std is meant to be magic, but if its not, it seems that it would documented in go help list and clearer usage with go doc std. I could also just be wrong on its usage (found via some random posts).

@ianlancetaylor ianlancetaylor changed the title Unexpected output with go doc std cmd/go: unexpected output with go doc std Jun 19, 2022
@ianlancetaylor
Copy link
Contributor

std is indeed special, and is documented in go help packages.

The fact that go doc std prints the docs for archive/tar (the first package in the standard library) certainly seems like a bug. Thanks.

CC @bcmills @matloob

@ianlancetaylor ianlancetaylor added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Jun 19, 2022
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Jun 19, 2022
@rafasha123

This comment was marked as spam.

@rafasha123

This comment was marked as spam.

@gopherbot
Copy link

Change https://go.dev/cl/413816 mentions this issue: cmd/doc: handle special case for std package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants
@ronaldpetty @ianlancetaylor @gopherbot @rafasha123 and others