]> Cypherpunks repositories - gostls13.git/commit
cmd/compile,cmd/internal/objabi: move -d flag parser to objabi
authorAustin Clements <austin@google.com>
Fri, 17 Sep 2021 14:07:41 +0000 (10:07 -0400)
committerAustin Clements <austin@google.com>
Fri, 5 Nov 2021 00:52:04 +0000 (00:52 +0000)
commit1c4cfd80109da81a2c6cf49b4d3ff49c45af8e03
tree6f38b16f18e3b37f26f364b6278cf4ba88b339c6
parent0e5f287fde7b2cf11c8cffb7839f970a8f3e2f9b
cmd/compile,cmd/internal/objabi: move -d flag parser to objabi

This moves and slightly generalizes the -d debug flag parser from
cmd/compile/internal/base to cmd/internal/objabi so that we can use
the same debug flag syntax in other tools.

This makes a few minor tweaks to implementation details. The flag
itself is now just a flag.Value that gets constructed explicitly,
rather than at init time, and we've cleaned up the implementation a
little (e.g., using a map instead of a linear search of a slice). The
help text is now automatically alphabetized. Rather than describing
the values of some flags in the help text footer, we simply include it
in the flags' help text and make sure multi-line help text renders
sensibly.

For #48297.

Change-Id: Id373ee3b767e456be483fb28c110d025149be532
Reviewed-on: https://go-review.googlesource.com/c/go/+/359956
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/base/debug.go
src/cmd/compile/internal/base/flag.go
src/cmd/internal/objabi/flag.go