diff options
| author | Austin Clements <austin@google.com> | 2021-09-17 09:56:21 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2021-10-30 18:30:34 +0000 |
| commit | 6113dacf32db7a996bc53fa7ca0db314cd3e7378 (patch) | |
| tree | 55f9aaca6cef3d12bbfc8117a0b7d9a1ba7bfc3c /src/bytes | |
| parent | f582778ee991e8a443e691f9a45c8f0600a748a0 (diff) | |
| download | go-6113dacf32db7a996bc53fa7ca0db314cd3e7378.tar.xz | |
cmd/compile: make -memprofilerate work
There are multiple things preventing the -memprofilerate flag from
working right now:
- CmdFlags.MemProfileRate has type int64, which is currently not
supported by the compiler's reflection-based registerFlags.
Unfortunately, rather than letting you know this, registerFlags
simply ignores this field.
- Nothing consumes CmdFlags.MemProfileRate anyway. startProfile
instead uses a package-local memprofilerate variable that is never
set to anything.
Fix this by making CmdFlags.MemProfileRate an int (that's what
runtime.MemProfileRate is anyway) and using it in startProfile. While
we're here, prevent similar flag parsing bugs in the future by making
registerFlags panic if it encounters a flag field of unsupported type.
Change-Id: Ib9a1fcd8f4c5e9d7175a4fabc375f31e79774f9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/359955
Trust: Austin Clements <austin@google.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/bytes')
0 files changed, 0 insertions, 0 deletions
