-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/vet: incorrectly warning for missing ellipsis in printf like function #26979
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
Comments
Investigating a bit deeper, and updating the report accordingly (with the understanding that I am quite new to vet code base, so might well be missing something). The issue seems to reside in Maybe we could then check in |
/cc @mvdan |
Thanks for reporting! This does seem like a regression at first glance, as the program does something correct. Your proposed solution also sounds fine, although I've never touched this part of vet. I might have a deeper look at this later today. |
Just a quick note about the title: while This report is coming from our CI (beta) job failing the build, so I guess I am trying to say I am not just nitpicking :) |
In all sincerity, you should just fix your code. I don’t mean this to be flippant, I know it is a cost to make what might appear to be a change just to keep vet happy, but this really is a potential data race, so investing the time in fixing this bug will make your code more reliable.
… On 16 Aug 2018, at 17:58, romaindoumenc ***@***.***> wrote:
Just a quick note about the title: while go vet itself might only warns of this issue, it now makes the test suite fail (running by default in Go 1.11). So this is actually very much an error.
This report is coming from our CI (beta) job failing the build, so I guess I am trying to say I am not just nitpicking :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I see no bug in the linked user code, neither do I see any data race. Please share where's the bug and where's the data race. Thanks. |
@davecheney thank you for your answer! I am at loss to see how this could be related in any way to a data race: the code is a simple, single-threaded nested function calls… Furthermore, I pointed in my early investigations that the root cause is likely on the way go vet identifies a formatting argument to a Happy to be shown otherwise of course! :) |
I think Dave's comment was meant for #27001 :) |
I'm very sorry, I mistakenly added a comment intended for a _different_ vet
issue to this issue. Please disregard my comments.
…On 16 August 2018 at 22:53, romaindoumenc ***@***.***> wrote:
@davecheney <https://github.com/davecheney> thank you for your answer! I
am at loss to see how this could be related in any way to a data race: the
code is a simple, single-threaded nested function calls…
Furthermore, I pointed in my early investigations that the root cause is
likely on the way go vet identifies a formatting argument to a printf
function (every second-to-last argument which is a string), and therefore
confuses a string argument with a formatting directive.
Happy to be shown otherwise of course! :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#26979 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA0_j4SjA7i-EkPbyL6qkly7FdQpIks5uRWtZgaJpZM4V78te>
.
|
Change https://golang.org/cl/129575 mentions this issue: |
I've just sent what I think is a simpler fix than what was suggested above. It simply avoids the ellipsis suggestion if it would break the program. Hopefully it's small enough to go in for 1.11 or 1.11.1. |
What version of Go are you using (
go version
)?Go 1.11rc1
Does this issue reproduce with the latest release?
No — only with the next (1.11) release candidate
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="$HOME/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="$HOME/dev"
GORACE=""
GOROOT="$HOME/sdk/go"
GOTMPDIR=""
GOTOOLDIR="$HOME/sdk/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build637964582=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Passing multiple arguments to a printf-like function, where the last argument is an array.
https://play.golang.org/p/k7ZwTL59hIu
What did you expect to see?
Go vet accepts this program (as it did in Go1.10)
What did you see instead?
An error message is displayed:
The text was updated successfully, but these errors were encountered: