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

Comments

Projects
None yet
6 participants
@camarena
Copy link

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

This comment has been minimized.

Copy link
Member

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

@camarena

This comment has been minimized.

Copy link
Author

commented Apr 2, 2018

@bcmills bcmills added this to the Go1.11 milestone Apr 2, 2018

@robpike

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2018

Please provide a complete example.

@gopherbot

This comment has been minimized.

Copy link

commented May 2, 2018

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.)

@gopherbot gopherbot closed this May 2, 2018

@josharian

This comment has been minimized.

Copy link
Contributor

commented May 2, 2018

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

@gopherbot gopherbot closed this May 2, 2018

@josharian

This comment has been minimized.

Copy link
Contributor

commented May 2, 2018

Bad @gopherbot.

@josharian josharian reopened this May 2, 2018

@mvdan

This comment has been minimized.

Copy link
Member

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 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

This comment has been minimized.

Copy link

commented May 4, 2018

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

@gopherbot gopherbot closed this in d0ed8d6 May 4, 2018

timfallmk added a commit to vapor-ware/ksync that referenced this issue Sep 10, 2018

Updates to linting to fix CI
- 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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.