| 1 |
// Copyright 2015 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
// Doc (usually run as go doc) accepts zero, one or two arguments. |
| 6 |
// |
| 7 |
// Zero arguments: |
| 8 |
// |
| 9 |
// go doc |
| 10 |
// |
| 11 |
// Show the documentation for the package in the current directory. |
| 12 |
// |
| 13 |
// One argument: |
| 14 |
// |
| 15 |
// go doc <pkg> |
| 16 |
// go doc <sym>[.<methodOrField>] |
| 17 |
// go doc [<pkg>.]<sym>[.<methodOrField>] |
| 18 |
// go doc [<pkg>.][<sym>.]<methodOrField> |
| 19 |
// |
| 20 |
// The first item in this list that succeeds is the one whose documentation |
| 21 |
// is printed. If there is a symbol but no package, the package in the current |
| 22 |
// directory is chosen. However, if the argument begins with a capital |
| 23 |
// letter it is always assumed to be a symbol in the current directory. |
| 24 |
// |
| 25 |
// Two arguments: |
| 26 |
// |
| 27 |
// go doc <pkg> <sym>[.<methodOrField>] |
| 28 |
// |
| 29 |
// Show the documentation for the package, symbol, and method or field. The |
| 30 |
// first argument must be a full package path. This is similar to the |
| 31 |
// command-line usage for the godoc command. |
| 32 |
// |
| 33 |
// For commands, unless the -cmd flag is present "go doc command" |
| 34 |
// shows only the package-level docs for the package. |
| 35 |
// |
| 36 |
// The -src flag causes doc to print the full source code for the symbol, such |
| 37 |
// as the body of a struct, function or method. |
| 38 |
// |
| 39 |
// The -all flag causes doc to print all documentation for the package and |
| 40 |
// all its visible symbols. The argument must identify a package. |
| 41 |
// |
| 42 |
// For complete documentation, run "go help doc". |
| 43 |
package main |
| 44 |
|
| 45 |
import ( |
| 46 |
"cmd/internal/doc" |
| 47 |
"cmd/internal/telemetry/counter" |
| 48 |
"os" |
| 49 |
) |
| 50 |
|
| 51 |
func main() { |
| 52 |
counter.Open() |
| 53 |
counter.Inc("doc/invocations") |
| 54 |
doc.Main(os.Args[1:]) |
| 55 |
} |