From 5ee0d1795a49c9ff5b1521219f788a97199bf23b Mon Sep 17 00:00:00 2001 From: yincong Date: Fri, 13 Jun 2025 17:00:40 +0800 Subject: [PATCH 1/2] Fixes #74139 --- src/cmd/go/internal/doc/doc.go | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/cmd/go/internal/doc/doc.go b/src/cmd/go/internal/doc/doc.go index 131da814951d0f..480a12c5d8a795 100644 --- a/src/cmd/go/internal/doc/doc.go +++ b/src/cmd/go/internal/doc/doc.go @@ -108,26 +108,20 @@ Examples: cd go/src/encoding/json; go doc decode Flags: + -C dir + change to dir before running command -all - Show all the documentation for the package. - -c - Respect case when matching symbols. + show all documentation for package + -c symbol matching honors case (paths not affected) -cmd - Treat a command (package main) like a regular package. - Otherwise package main's exported symbols are hidden - when showing the package's top-level documentation. + show symbols with package docs even if package is a command + -http + serve HTML docs over HTTP -short - One-line representation for each symbol. + one-line representation for each symbol -src - Show the full source code for the symbol. This will - display the full Go source of its declaration and - definition, such as a function definition (including - the body), type declaration or enclosing const - block. The output may therefore include unexported - details. - -u - Show documentation for unexported as well as exported - symbols, methods, and fields. + show source code for symbol + -u show unexported symbols as well as exported `, } From 6b40ba192c1b82ed80b121d7ab6b1565ad1ef6e9 Mon Sep 17 00:00:00 2001 From: yincong Date: Fri, 13 Jun 2025 17:07:33 +0800 Subject: [PATCH 2/2] optimize --- src/cmd/go/internal/doc/doc.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/cmd/go/internal/doc/doc.go b/src/cmd/go/internal/doc/doc.go index 480a12c5d8a795..7099833f1fcb4d 100644 --- a/src/cmd/go/internal/doc/doc.go +++ b/src/cmd/go/internal/doc/doc.go @@ -108,20 +108,20 @@ Examples: cd go/src/encoding/json; go doc decode Flags: - -C dir - change to dir before running command - -all - show all documentation for package - -c symbol matching honors case (paths not affected) - -cmd - show symbols with package docs even if package is a command - -http - serve HTML docs over HTTP - -short - one-line representation for each symbol - -src - show source code for symbol - -u show unexported symbols as well as exported + -C dir + change to dir before running command + -all + show all documentation for package + -c symbol matching honors case (paths not affected) + -cmd + show symbols with package docs even if package is a command + -http + serve HTML docs over HTTP + -short + one-line representation for each symbol + -src + show source code for symbol + -u show unexported symbols as well as exported `, }