Skip to content

Commit

Permalink
cmd/gop: run/build/install/test -v => -debug
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Jun 26, 2022
1 parent c0aa269 commit a5f77fd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
1 change: 1 addition & 0 deletions cmd/internal/base/pass.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions cmd/internal/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions cmd/internal/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down
9 changes: 2 additions & 7 deletions cmd/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
Expand All @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/internal/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down

0 comments on commit a5f77fd

Please sign in to comment.