help

Imports

Imports #

"bufio"
"fmt"
"io"
"os"
"strings"
"text/template"
"unicode"
"unicode/utf8"
"cmd/go/internal/base"
"cmd/internal/telemetry/counter"
"cmd/go/internal/base"

Constants & Variables

HelpBuildConstraint var #

var HelpBuildConstraint = *ast.UnaryExpr

HelpBuildJSON var #

var HelpBuildJSON = *ast.UnaryExpr

HelpBuildmode var #

var HelpBuildmode = *ast.UnaryExpr

HelpC var #

var HelpC = *ast.UnaryExpr

HelpCache var #

var HelpCache = *ast.UnaryExpr

HelpEnvironment var #

var HelpEnvironment = *ast.UnaryExpr

HelpFileType var #

var HelpFileType = *ast.UnaryExpr

HelpGoAuth var #

var HelpGoAuth = *ast.UnaryExpr

HelpGopath var #

var HelpGopath = *ast.UnaryExpr

HelpImportPath var #

var HelpImportPath = *ast.UnaryExpr

HelpPackages var #

var HelpPackages = *ast.UnaryExpr

counterErrorsHelpUnknownTopic var #

var counterErrorsHelpUnknownTopic = *ast.CallExpr

documentationTemplate var #

var documentationTemplate = *ast.BinaryExpr

helpTemplate var #

var helpTemplate = `{{if .Runnable}}usage: {{.UsageLine}}

{{end}}{{.Long | trim}}
`

usageTemplate var #

var usageTemplate = `{{.Long | trim}}

Usage:

	{{.UsageLine}}  [arguments]

The commands are:
{{range .Commands}}{{if or (.Runnable) .Commands}}
	{{.Name | printf "%-11s"}} {{.Short}}{{end}}{{end}}

Use "go help{{with .LongName}} {{.}}{{end}} " for more information about a command.
{{if eq (.UsageLine) "go"}}
Additional help topics:
{{range .Commands}}{{if and (not .Runnable) (not .Commands)}}
	{{.Name | printf "%-15s"}} {{.Short}}{{end}}{{end}}

Use "go help{{with .LongName}} {{.}}{{end}} " for more information about that topic.
{{end}}
`

Structs

commentWriter struct #

commentWriter writes a Go comment to the underlying io.Writer, using line comment form (//).

type commentWriter struct {
W io.Writer
wroteSlashes bool
}

errWriter struct #

An errWriter wraps a writer, recording whether a write error occurred.

type errWriter struct {
w io.Writer
err error
}

Functions

Help function #

Help implements the 'help' command.

func Help(w io.Writer, args []string)

PrintUsage function #

func PrintUsage(w io.Writer, cmd *base.Command)

Write method #

func (c *commentWriter) Write(p []byte) (int, error)

Write method #

func (w *errWriter) Write(b []byte) (int, error)

capitalize function #

func capitalize(s string) string

tmpl function #

tmpl executes the given template text on data, writing the result to w.

func tmpl(w io.Writer, text string, data any)

Generated with Arrow