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

cmd/vet: missing 'possible formatting directive in Fprintln call' warning #24646

Closed
camarena opened this issue Apr 2, 2018 · 8 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@camarena
Copy link

camarena commented Apr 2, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.1 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/camarena/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/camarena/go"
GORACE=""
GOROOT="/Users/camarena/homebrew/Cellar/go/1.10.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/Users/camarena/homebrew/Cellar/go/1.10.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/22/p1vpwjb10wq7gcjp63w9ccdr00d83_/T/go-build934642368=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I had this method:
func (ccp CommandParser) WriteHelp(w io.Writer) {
fmt.Fprintln(w, "%T.WriteHelp Not implemented Yet", ccp)
}

it should be

func (ccp CommandParser) WriteHelp(w io.Writer) {
fmt.Fprintf(w, "%T.WriteHelp Not implemented Yet\n", ccp)
}

What did you expect to see?

I expect to see the message: "possible formatting directive in Fprintln call"
as it is reported in linux.

What did you see instead?

no message and no error reported on macos

@bcmills
Copy link
Contributor

bcmills commented Apr 2, 2018

What command line did you use to invoke vet?

@bcmills bcmills changed the title vet does not report 'possible formatting directive in Fprintln call' in macos cmd/vet: missing 'possible formatting directive in Fprintln call' on MacOS Apr 2, 2018
@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 2, 2018
@camarena
Copy link
Author

camarena commented Apr 2, 2018 via email

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Apr 2, 2018
@bcmills bcmills added this to the Go1.11 milestone Apr 2, 2018
@robpike
Copy link
Contributor

robpike commented Apr 2, 2018

Please provide a complete example.

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 2, 2018
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@josharian
Copy link
Contributor

A complete example is easy enough to construct from the original issue, and it appears to reproduce still:

package main

import (
	"fmt"
	"io"
)

type CommandParser int

func (ccp CommandParser) WriteHelp(w io.Writer) {
	fmt.Fprintln(w, "%T.WriteHelp Not implemented Yet\n", ccp)
}

@josharian josharian reopened this May 2, 2018
@josharian
Copy link
Contributor

Bad @gopherbot.

@josharian josharian reopened this May 2, 2018
@mvdan
Copy link
Member

mvdan commented May 4, 2018

Thanks for the complete reproducer, @josharian. I can reproduce the bug on Linux, so I'm going to look into a fix.

@mvdan mvdan removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 4, 2018
@mvdan mvdan changed the title cmd/vet: missing 'possible formatting directive in Fprintln call' on MacOS cmd/vet: missing 'possible formatting directive in Fprintln call' warning May 4, 2018
@mvdan mvdan self-assigned this May 4, 2018
@gopherbot
Copy link

Change https://golang.org/cl/111357 mentions this issue: cmd/vet: %T is a formatting directive too

timfallmk pushed a commit to ksync/ksync that referenced this issue Sep 10, 2018
- Disable `vet` for pkg/ksync/server/restart.go:57 (golang/go#24646)
- Re-enable `gosec`
@golang golang locked and limited conversation to collaborators May 4, 2019
@rsc rsc unassigned mvdan Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants