Repository: goplus/gop
Pull request #1572 (2023-12-11 02:05:11)

mv cmd/make.go => cmd/make/make.go


Patch:
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 8970d496..1fa5d407 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -25,7 +25,7 @@ jobs:
       run: |
         git config --global user.email "build-robot@goplus.org"
         git config --global user.name "build robot"
-        go test -v cmd/make_test.go
+        go test -v cmd/make/make_test.go
 
     - name: Compile gop and related tools
       run: go install ./...
diff --git a/Makefile b/Makefile
index bddf0767..05ef5e31 100644
--- a/Makefile
+++ b/Makefile
@@ -10,12 +10,12 @@ clean:
 	rm -f bin/*
 
 build:
-	go run cmd/make.go -build
+	go run cmd/make/make.go -build
 
 dist:
 	$(MAKE) clean
 	mkdir -p bin/
-	go build -o $(BUILD_ROOT_DIR)/make cmd/make.go
+	go build -o $(BUILD_ROOT_DIR)/make cmd/make/make.go
 	$(MAKE) build-all
 
 build-all: darwin-amd64.zip darwin-arm64.zip linux-386.zip linux-amd64.zip \
diff --git a/all.bash b/all.bash
index 8fe94a61..b7887680 100755
--- a/all.bash
+++ b/all.bash
@@ -18,4 +18,4 @@
 
 set -ex
 
-go run cmd/make.go --install --autoproxy
+go run cmd/make/make.go --install --autoproxy
diff --git a/all.bat b/all.bat
index 0812ec4b..f8689047 100644
--- a/all.bat
+++ b/all.bat
@@ -1,1 +1,1 @@
-go run cmd\make.go --install --autoproxy
+go run cmd/make/make.go --install --autoproxy
diff --git a/cmd/internal/help/help.go b/cmd/internal/help/help.go
index 9d48f3c9..77728cff 100644
--- a/cmd/internal/help/help.go
+++ b/cmd/internal/help/help.go
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-// Package help implements the ``gop help'' command.
+// Package help implements the “gop help” command.
 package help
 
 import (
@@ -58,7 +58,6 @@ Args:
 		cmd.Usage(w)
 	}
 	// not exit 2: succeeded at 'gop help cmd'.
-	return
 }
 
 var usageTemplate = `{{.Short | trim}}
@@ -75,38 +74,6 @@ Use "gop help{{with .LongName}} {{.}}{{end}} <command>" for more information abo
 
 `
 
-// commentWriter writes a Go comment to the underlying io.Writer,
-// using line comment form (//).
-type commentWriter struct {
-	W            io.Writer
-	wroteSlashes bool // Wrote "//" at the beginning of the current line.
-}
-
-func (c *commentWriter) Write(p []byte) (int, error) {
-	var n int
-	for i, b := range p {
-		if !c.wroteSlashes {
-			s := "//"
-			if b != '\n' {
-				s = "// "
-			}
-			if _, err := io.WriteString(c.W, s); err != nil {
-				return n, err
-			}
-			c.wroteSlashes = true
-		}
-		n0, err := c.W.Write(p[i : i+1])
-		n += n0
-		if err != nil {
-			return n, err
-		}
-		if b == '\n' {
-			c.wroteSlashes = false
-		}
-	}
-	return len(p), nil
-}
-
 // An errWriter wraps a writer, recording whether a write error occurred.
 type errWriter struct {
 	w   io.Writer
diff --git a/make.bash b/make.bash
index 8fe94a61..b7887680 100755
--- a/make.bash
+++ b/make.bash
@@ -18,4 +18,4 @@
 
 set -ex
 
-go run cmd/make.go --install --autoproxy
+go run cmd/make/make.go --install --autoproxy
diff --git a/make.bat b/make.bat
index 5395a855..f8689047 100644
--- a/make.bat
+++ b/make.bat
@@ -1,1 +1,1 @@
-go run cmd/make.go --install --autoproxy
+go run cmd/make/make.go --install --autoproxy


Test patch:
diff --git a/cmd/make.go b/cmd/make/make.go
similarity index 100%
rename from cmd/make.go
rename to cmd/make/make.go
diff --git a/cmd/make_test.go b/cmd/make/make_test.go
similarity index 99%
rename from cmd/make_test.go
rename to cmd/make/make_test.go
index e1ae186d..a5556e7c 100644
--- a/cmd/make_test.go
+++ b/cmd/make/make_test.go
@@ -21,7 +21,7 @@ const (
 var script = "all.bash"
 var gopRoot = ""
 var gopBinFiles = []string{"gop", "gopfmt"}
-var installer = "cmd/make.go"
+var installer = "cmd/make/make.go"
 var versionFile = "VERSION"
 var mainVersionFile = "env/version.go"
 
@@ -79,7 +79,7 @@ func detectGoBinPath() string {
 
 func init() {
 	pwd, _ := os.Getwd()
-	gopRoot = filepath.Join(pwd, "..")
+	gopRoot = filepath.Join(pwd, "../..")
 	installer = filepath.Join(gopRoot, installer)
 	versionFile = filepath.Join(gopRoot, versionFile)
 	mainVersionFile = filepath.Join(gopRoot, mainVersionFile)