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/doc: nothing printed for main packages #25728

Closed
willfaught opened this issue Jun 5, 2018 · 3 comments
Closed

cmd/doc: nothing printed for main packages #25728

willfaught opened this issue Jun 5, 2018 · 3 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@willfaught
Copy link
Contributor

Surely it would be useful to print the typical package doc for a main package: print the package comments, list the declarations, etc.

What did you do?

Where t.go is:

package main

type T int

func main() {}

I did:

$ ls
t.go
$ go doc

What did you expect to see?

$ go doc
package main

type T int

$

What did you see instead?

$ go doc

$

Note that:

$ go doc T
type T int
$

System details

go version go1.10.2 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/will/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/will/Developer/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/t3/p8srlt1j4473h_4ptph5r1xh0000gn/T/go-build390446043=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version go1.10.2 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.10.2
uname -v: Darwin Kernel Version 17.6.0: Tue May  8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.5
BuildVersion:	17F77
lldb --version: lldb-902.0.79.7
  Swift-4.1
@meirf
Copy link
Contributor

meirf commented Jun 5, 2018

godoc -src . would give your desired output.

Similar to #25595

@FiloSottile FiloSottile added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 5, 2018
@FiloSottile FiloSottile added this to the Go1.12 milestone Jun 5, 2018
@robpike
Copy link
Contributor

robpike commented Jun 5, 2018

Working as intended. If you add a package comment, you'll see that.

@robpike robpike closed this as completed Jun 5, 2018
@willfaught
Copy link
Contributor Author

willfaught commented Jun 5, 2018

@meirf godoc isn't the same as go doc, but thanks for the tip.

@golang golang locked and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants