aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/alldocs.go3
-rw-r--r--src/cmd/go/internal/doc/doc.go6
-rw-r--r--src/cmd/go/testdata/script/doc_all_short.txt2
3 files changed, 9 insertions, 2 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 8533fd2af1..85a82bc57d 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -457,7 +457,8 @@
// -http
// Serve HTML docs over HTTP.
// -short
-// One-line representation for each symbol.
+// One-line representation for each symbol. Cannot be
+// combined with -all.
// -src
// Show the full source code for the symbol. This will
// display the full Go source of its declaration and
diff --git a/src/cmd/go/internal/doc/doc.go b/src/cmd/go/internal/doc/doc.go
index fd6d663375..4acee8ed42 100644
--- a/src/cmd/go/internal/doc/doc.go
+++ b/src/cmd/go/internal/doc/doc.go
@@ -134,7 +134,8 @@ Flags:
-http
Serve HTML docs over HTTP.
-short
- One-line representation for each symbol.
+ One-line representation for each symbol. Cannot be
+ combined with -all.
-src
Show the full source code for the symbol. This will
display the full Go source of its declaration and
@@ -206,6 +207,9 @@ func do(ctx context.Context, writer io.Writer, flagSet *flag.FlagSet, args []str
return err
}
}
+ if showAll && short {
+ return fmt.Errorf("cannot combine -all and -short")
+ }
if serveHTTP {
// Special case: if there are no arguments, try to go to an appropriate page
// depending on whether we're in a module or workspace. The pkgsite homepage
diff --git a/src/cmd/go/testdata/script/doc_all_short.txt b/src/cmd/go/testdata/script/doc_all_short.txt
new file mode 100644
index 0000000000..e6a89ec98e
--- /dev/null
+++ b/src/cmd/go/testdata/script/doc_all_short.txt
@@ -0,0 +1,2 @@
+! go doc -all -short
+stderr 'doc: cannot combine -all and -short' \ No newline at end of file