Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: support underscore separators in -benchtime counts #60176

Open
mvdan opened this issue May 13, 2023 · 1 comment
Open

testing: support underscore separators in -benchtime counts #60176

mvdan opened this issue May 13, 2023 · 1 comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@mvdan
Copy link
Member

mvdan commented May 13, 2023

What version of Go are you using (go version)?

$ go version
go version devel go1.21-91b8cc0dfa Sat May 13 00:22:50 2023 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/mvdan/.cache/go-build'
GOENV='/home/mvdan/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/mvdan/go/pkg/mod'
GONOPROXY='github.com/cue-unity'
GONOSUMDB='github.com/cue-unity'
GOOS='linux'
GOPATH='/home/mvdan/go'
GOPRIVATE='github.com/cue-unity'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/mvdan/tip'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLDIR='/home/mvdan/tip/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.21-91b8cc0dfa Sat May 13 00:22:50 2023 +0000'
GCCGO='gccgo'
GOAMD64='v3'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1112140393=/tmp/go-build -gno-record-gcc-switches'
GOROOT/bin/go version: go version devel go1.21-91b8cc0dfa Sat May 13 00:22:50 2023 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel go1.21-91b8cc0dfa Sat May 13 00:22:50 2023 +0000
uname -sr: Linux 6.3.1-arch2-1
LSB Version:	n/a
Distributor ID:	Arch
Description:	Arch Linux
Release:	rolling
Codename:	n/a
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.37.
gdb --version: GNU gdb (GDB) 13.1

What did you do?

go test -bench=. -benchtime=40_000x, because I found that easier to read than -benchtime=40000x .

What did you expect to see?

It should work the same with or without underscores, like numeric literals in Go code.

What did you see instead?

invalid value "40_000x" for flag -test.benchtime: invalid count

This appears to be because we call strconv.ParseInt with base = 10, and the API is documented to only support underscore separators with base = 0. Slightly unfortunate if we don't want to support other bases like -benchtime=0x123, but I guess they're not harmful either.

@heschi
Copy link
Contributor

heschi commented May 15, 2023

cc @bcmills

@heschi heschi added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label May 15, 2023
@heschi heschi added this to the Backlog milestone May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

2 participants