]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/doc: merge with cmd/go/internal/doc
authorMichael Matloob <matloob@golang.org>
Wed, 23 Jul 2025 15:25:14 +0000 (11:25 -0400)
committerMichael Matloob <matloob@google.com>
Thu, 24 Jul 2025 16:59:40 +0000 (09:59 -0700)
Now that cmd/doc has been removed, cmd/go/internal/doc is the only user
of the cmd/internal/doc code. Merge cmd/internal/doc into
cmd/go/internal/doc.

For #74667

Change-Id: I16bbe7b1f418b54ee411c8d6e6609c0973e40b3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/689836
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 files changed:
src/cmd/go/internal/doc/dirs.go [moved from src/cmd/internal/doc/dirs.go with 99% similarity]
src/cmd/go/internal/doc/doc.go
src/cmd/go/internal/doc/doc_test.go [moved from src/cmd/internal/doc/doc_test.go with 99% similarity]
src/cmd/go/internal/doc/main.go [moved from src/cmd/internal/doc/main.go with 97% similarity]
src/cmd/go/internal/doc/pkg.go [moved from src/cmd/internal/doc/pkg.go with 99% similarity]
src/cmd/go/internal/doc/signal_notunix.go [moved from src/cmd/internal/doc/signal_notunix.go with 100% similarity]
src/cmd/go/internal/doc/signal_unix.go [moved from src/cmd/internal/doc/signal_unix.go with 100% similarity]
src/cmd/go/internal/doc/testdata/merge/aa.go [moved from src/cmd/internal/doc/testdata/merge/aa.go with 100% similarity]
src/cmd/go/internal/doc/testdata/merge/bb.go [moved from src/cmd/internal/doc/testdata/merge/bb.go with 100% similarity]
src/cmd/go/internal/doc/testdata/nested/empty/empty.go [moved from src/cmd/internal/doc/testdata/nested/empty/empty.go with 100% similarity]
src/cmd/go/internal/doc/testdata/nested/ignore.go [moved from src/cmd/internal/doc/testdata/nested/ignore.go with 100% similarity]
src/cmd/go/internal/doc/testdata/nested/nested/real.go [moved from src/cmd/internal/doc/testdata/nested/nested/real.go with 100% similarity]
src/cmd/go/internal/doc/testdata/pkg.go [moved from src/cmd/internal/doc/testdata/pkg.go with 100% similarity]

similarity index 99%
rename from src/cmd/internal/doc/dirs.go
rename to src/cmd/go/internal/doc/dirs.go
index 8b1670f61c253c5e0ef5795878c0ecee2f797884..350c3865874bcee09ffd8ff5375fbca7b5bfe2cc 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !cmd_go_bootstrap
+
 package doc
 
 import (
index 74c70e2c7a50164cfa2a377dfe4529ccab8ccf9e..ed3c191dc38160cb76f783001ee9256e63b8b48e 100644 (file)
@@ -8,9 +8,12 @@
 package doc
 
 import (
-       "cmd/go/internal/base"
-       "cmd/internal/doc"
        "context"
+       "flag"
+       "log"
+       "os"
+
+       "cmd/go/internal/base"
 )
 
 var CmdDoc = &base.Command{
@@ -136,5 +139,12 @@ Flags:
 }
 
 func runDoc(ctx context.Context, cmd *base.Command, args []string) {
-       doc.Main(args)
+       log.SetFlags(0)
+       log.SetPrefix("doc: ")
+       dirsInit()
+       var flagSet flag.FlagSet
+       err := do(os.Stdout, &flagSet, args)
+       if err != nil {
+               log.Fatal(err)
+       }
 }
similarity index 99%
rename from src/cmd/internal/doc/doc_test.go
rename to src/cmd/go/internal/doc/doc_test.go
index bccace40c0fb5413ed14b88f77a869183034aa30..f91dcd658f247b6b966d9eaa77f7c2e60629de90 100644 (file)
@@ -29,7 +29,7 @@ func TestMain(m *testing.M) {
        buildCtx.GOROOT = testenv.GOROOT(nil)
        build.Default.GOROOT = testenv.GOROOT(nil)
 
-       // Add $GOROOT/src/cmd/doc/testdata explicitly so we can access its contents in the test.
+       // Add $GOROOT/src/cmd/go/internal/doc/testdata explicitly so we can access its contents in the test.
        // Normally testdata directories are ignored, but sending it to dirs.scan directly is
        // a hack that works around the check.
        testdataDir, err := filepath.Abs("testdata")
@@ -90,7 +90,7 @@ type test struct {
        no   []string // Regular expressions that should not match.
 }
 
-const p = "cmd/internal/doc/testdata"
+const p = "cmd/go/internal/doc/testdata"
 
 var tests = []test{
        // Sanity check.
@@ -105,7 +105,7 @@ var tests = []test{
        {
                "package clause",
                []string{p},
-               []string{`package pkg.*cmd/internal/doc/testdata`},
+               []string{`package pkg.*cmd/go/internal/doc/testdata`},
                nil,
        },
 
similarity index 97%
rename from src/cmd/internal/doc/main.go
rename to src/cmd/go/internal/doc/main.go
index d61f4379bdc73fa572b57ee6fcc124a66d194b41..ee04f017fc3bfc8645b1bb3fe1063b3d39594910 100644 (file)
@@ -2,7 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Package doc provides the implementation of the "go doc" subcommand and cmd/doc.
+//go:build !cmd_go_bootstrap
+
 package doc
 
 import (
@@ -53,18 +54,6 @@ func usage(flagSet *flag.FlagSet) {
        os.Exit(2)
 }
 
-// Main is the entry point, invoked both by go doc and cmd/doc.
-func Main(args []string) {
-       log.SetFlags(0)
-       log.SetPrefix("doc: ")
-       dirsInit()
-       var flagSet flag.FlagSet
-       err := do(os.Stdout, &flagSet, args)
-       if err != nil {
-               log.Fatal(err)
-       }
-}
-
 // do is the workhorse, broken out of main to make testing easier.
 func do(writer io.Writer, flagSet *flag.FlagSet, args []string) (err error) {
        flagSet.Usage = func() { usage(flagSet) }
similarity index 99%
rename from src/cmd/internal/doc/pkg.go
rename to src/cmd/go/internal/doc/pkg.go
index 953b0d9a2840ab603a8fbe8d0c12ccc39a078639..989301d90909743d2dcbf58870f5956830ab3758 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !cmd_go_bootstrap
+
 package doc
 
 import (