From 3ee87d02b063e368259486d83e4ea391538f84c2 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 19 Feb 2013 11:19:58 -0800 Subject: cmd/godoc: use go/build to determine package and example files Also: - faster code for example extraction - simplify handling of command documentation: all "main" packages are treated as commands - various minor cleanups along the way For commands written in Go, any doc.go file containing documentation must now be part of package main (rather then package documentation), otherwise the documentation won't show up in godoc (it will still build, though). For commands written in C, documentation may still be in doc.go files defining package documentation, but the recommended way is to explicitly ignore those files with a +build ignore constraint to define package main. Fixes #4806. R=adg, rsc, dave, bradfitz CC=golang-dev https://golang.org/cl/7333046 --- src/cmd/nm/doc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cmd/nm') diff --git a/src/cmd/nm/doc.go b/src/cmd/nm/doc.go index 004567cad2..480c1c3dde 100644 --- a/src/cmd/nm/doc.go +++ b/src/cmd/nm/doc.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build ignore + /* Nm is a version of the Plan 9 nm command. The original is documented at @@ -18,4 +20,4 @@ Usage: go tool nm [-aghnsTu] file */ -package documentation +package main -- cgit v1.3