Repository: goplus/gop
Pull request #1309 (2022-06-26 12:47:35)

cmd/gop: run/build/install/test -v => -debug


Patch:
diff --git a/cmd/internal/base/pass.go b/cmd/internal/base/pass.go
index 8f7e15ce..729c1afc 100644
--- a/cmd/internal/base/pass.go
+++ b/cmd/internal/base/pass.go
@@ -61,6 +61,7 @@ func NewPassArgs(flag *flag.FlagSet) *PassArgs {
 
 func PassBuildFlags(cmd *Command) *PassArgs {
 	p := NewPassArgs(&cmd.Flag)
+	p.Bool("v")
 	p.Bool("n", "x")
 	p.Bool("a")
 	p.Bool("linkshared", "race", "msan", "asan",
diff --git a/cmd/internal/build/build.go b/cmd/internal/build/build.go
index 7bbc993f..365bf0e2 100644
--- a/cmd/internal/build/build.go
+++ b/cmd/internal/build/build.go
@@ -36,14 +36,14 @@ import (
 
 // gop build
 var Cmd = &base.Command{
-	UsageLine: "gop build [-v -o output] [packages]",
+	UsageLine: "gop build [-debug -o output] [packages]",
 	Short:     "Build Go+ files",
 }
 
 var (
-	flagVerbose = flag.Bool("v", false, "print verbose information")
-	flagOutput  = flag.String("o", "", "gop build output file")
-	flag        = &Cmd.Flag
+	flagDebug  = flag.Bool("debug", false, "print debug information")
+	flagOutput = flag.String("o", "", "gop build output file")
+	flag       = &Cmd.Flag
 )
 
 func init() {
@@ -57,7 +57,7 @@ func runCmd(cmd *base.Command, args []string) {
 		log.Panicln("parse input arguments failed:", err)
 	}
 
-	if *flagVerbose {
+	if *flagDebug {
 		gox.SetDebug(gox.DbgFlagAll &^ gox.DbgFlagComments)
 		cl.SetDebug(cl.DbgFlagAll)
 		cl.SetDisableRecover(true)
diff --git a/cmd/internal/install/install.go b/cmd/internal/install/install.go
index 7de17a69..cb321756 100644
--- a/cmd/internal/install/install.go
+++ b/cmd/internal/install/install.go
@@ -35,13 +35,13 @@ import (
 
 // gop install
 var Cmd = &base.Command{
-	UsageLine: "gop install [-v] [packages]",
+	UsageLine: "gop install [-debug] [packages]",
 	Short:     "Build Go+ files and install target to GOBIN",
 }
 
 var (
-	flag        = &Cmd.Flag
-	flagVerbose = flag.Bool("v", false, "print verbose information")
+	flag      = &Cmd.Flag
+	flagDebug = flag.Bool("debug", false, "print debug information")
 )
 
 func init() {
@@ -65,7 +65,7 @@ func runCmd(cmd *base.Command, args []string) {
 		log.Panicln("gopprojs.ParseAll:", err)
 	}
 
-	if *flagVerbose {
+	if *flagDebug {
 		gox.SetDebug(gox.DbgFlagAll &^ gox.DbgFlagComments)
 		cl.SetDebug(cl.DbgFlagAll)
 		cl.SetDisableRecover(true)
diff --git a/cmd/internal/run/run.go b/cmd/internal/run/run.go
index fc82d407..fcf1fa03 100644
--- a/cmd/internal/run/run.go
+++ b/cmd/internal/run/run.go
@@ -42,9 +42,8 @@ var Cmd = &base.Command{
 var (
 	flag        = &Cmd.Flag
 	flagAsm     = flag.Bool("asm", false, "generates `asm` code of Go+ bytecode backend")
-	flagVerbose = flag.Bool("v", false, "print verbose information")
+	flagDebug   = flag.Bool("debug", false, "print debug information")
 	flagQuiet   = flag.Bool("quiet", false, "don't generate any compiling stage log")
-	flagDebug   = flag.Bool("debug", false, "set log level to debug")
 	flagNoChdir = flag.Bool("nc", false, "don't change dir (only for `gop run pkgPath`)")
 	flagProf    = flag.Bool("prof", false, "do profile and generate profile report")
 )
@@ -70,14 +69,10 @@ func runCmd(cmd *base.Command, args []string) {
 
 	if *flagQuiet {
 		log.SetOutputLevel(0x7000)
-	} else if *flagVerbose {
+	} else if *flagDebug {
 		gox.SetDebug(gox.DbgFlagAll &^ gox.DbgFlagComments)
 		cl.SetDebug(cl.DbgFlagAll)
 		cl.SetDisableRecover(true)
-	} else if *flagDebug {
-		log.SetOutputLevel(log.Ldebug)
-		gox.SetDebug(gox.DbgFlagAll)
-		cl.SetDebug(cl.DbgFlagAll)
 	} else if *flagAsm {
 		gox.SetDebug(gox.DbgFlagInstruction)
 	}


Test patch:
diff --git a/cmd/internal/test/test.go b/cmd/internal/test/test.go
index f6650678..e8a94a6a 100644
--- a/cmd/internal/test/test.go
+++ b/cmd/internal/test/test.go
@@ -35,13 +35,13 @@ import (
 
 // gop test
 var Cmd = &base.Command{
-	UsageLine: "gop test [-v] [packages]",
+	UsageLine: "gop test [-debug] [packages]",
 	Short:     "Test Go+ packages",
 }
 
 var (
-	flag        = &Cmd.Flag
-	flagVerbose = flag.Bool("v", false, "print verbose information")
+	flag      = &Cmd.Flag
+	flagDebug = flag.Bool("debug", false, "print debug information")
 )
 
 func init() {
@@ -65,7 +65,7 @@ func runCmd(cmd *base.Command, args []string) {
 		log.Panicln("gopprojs.ParseAll:", err)
 	}
 
-	if *flagVerbose {
+	if *flagDebug {
 		gox.SetDebug(gox.DbgFlagAll &^ gox.DbgFlagComments)
 		cl.SetDebug(cl.DbgFlagAll)
 		cl.SetDisableRecover(true)