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 --- lib/godoc/package.html | 2 +- lib/godoc/package.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/godoc/package.html b/lib/godoc/package.html index cff91fa226..85c737ec3a 100644 --- a/lib/godoc/package.html +++ b/lib/godoc/package.html @@ -10,7 +10,7 @@ correspond to Go identifiers). --> {{with .PDoc}} - {{if $.IsPkg}} + {{if not $.IsMain}}
import "{{html .ImportPath}}"
diff --git a/lib/godoc/package.txt b/lib/godoc/package.txt index 12964b0010..16678d5f01 100644 --- a/lib/godoc/package.txt +++ b/lib/godoc/package.txt @@ -2,7 +2,7 @@ --------------------------------------- -*/}}{{with .PDoc}}{{if $.IsPkg}}PACKAGE +*/}}{{with .PDoc}}{{if not $.IsMain}}PACKAGE package {{.Name}} import "{{.ImportPath}}" -- cgit v1.2.1