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: errors printed twice #26222

Closed
thaJeztah opened this issue Jul 4, 2018 · 4 comments
Closed

cmd/vet: errors printed twice #26222

thaJeztah opened this issue Jul 4, 2018 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@thaJeztah
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11beta1 linux/amd64

Does this issue reproduce with the latest release?

yes

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

Linux eb9a716da0da 4.9.87-linuxkit-aufs #1 SMP Fri Mar 16 18:16:33 UTC 2018 x86_64 GNU/Linux

What did you do?

  1. create a directory foo, and inside that directory, create a file named test.go:
package test

type MyStruct struct {}
func test(mystructs []*MyStruct) *MyStruct {
	var foo *MyStruct
	for _, mystruct := range mystructs {
		foo := mystruct
	}
	return foo
}
  1. Run go vet .

What did you expect to see?

go vet --shadow .
# _/foo
./test.go:7:3: foo declared and not used
output of `go vet -n .` on Go 1.10.3
go vet -n .

#
# _/foo
#

mkdir -p $WORK/b001/
cat >$WORK/b001/importcfg << 'EOF' # internal
# import config
EOF
cd /foo
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b001/_pkg_.a -trimpath $WORK/b001 -p _/foo -complete -buildid aXr0bcv5wH9Nf8pWdoRi/aXr0bcv5wH9Nf8pWdoRi -goversion go1.10.3 -D _/foo -importcfg $WORK/b001/importcfg -pack -c=4 ./test.go
/usr/local/go/pkg/tool/linux_amd64/buildid -w $WORK/b001/_pkg_.a # internal
cat >$WORK/b001/vet.cfg << 'EOF' # internal
{
	"Compiler": "gc",
	"Dir": "/foo",
	"GoFiles": [
		"/foo/test.go"
	],
	"ImportMap": {
		"fmt": "fmt"
	},
	"PackageFile": {
		"fmt": "/usr/local/go/pkg/linux_amd64/fmt.a"
	},
	"ImportPath": "_/foo",
	"SucceedOnTypecheckFailure": false
}
EOF
/usr/local/go/pkg/tool/linux_amd64/vet $WORK/b001/vet.cfg

What did you see instead?

go vet .
# _/foo
./test.go:7:3: foo declared and not used
# _/foo
./test.go:7:3: foo declared but not used
vet: typecheck failures
output of `go vet -n .` on Go 1.11beta1
go vet -n .

#
# _/foo
#

mkdir -p $WORK/b001/
cat >$WORK/b001/importcfg << 'EOF' # internal
# import config
EOF
cd /foo
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b001/_pkg_.a -trimpath $WORK/b001 -p _/foo -complete -buildid SnS1ot0kWnaJXBLTwvxT/SnS1ot0kWnaJXBLTwvxT -goversion go1.11beta1 -D _/foo -importcfg $WORK/b001/importcfg -pack -c=4 ./test.go
/usr/local/go/pkg/tool/linux_amd64/buildid -w $WORK/b001/_pkg_.a # internal
cat >$WORK/b001/vet.cfg << 'EOF' # internal
{
	"Compiler": "gc",
	"Dir": "/foo",
	"ImportPath": "_/foo",
	"GoFiles": [
		"/foo/test.go"
	],
	"ImportMap": {
		"fmt": "fmt"
	},
	"PackageFile": {
		"fmt": "/usr/local/go/pkg/linux_amd64/fmt.a"
	},
	"Standard": {
		"fmt": true
	},
	"PackageVetx": {},
	"VetxOnly": false,
	"VetxOutput": "$WORK/b001/vet.out",
	"SucceedOnTypecheckFailure": false
}
EOF
/usr/local/go/pkg/tool/linux_amd64/vet $WORK/b001/vet.cfg

This issue is currently breaking gometalinter; see alecthomas/gometalinter#499

@thaJeztah thaJeztah changed the title Go 1.11beta1: go vet prints errors twice Go 1.11beta1: go vet prints output twice Jul 5, 2018
@agnivade agnivade changed the title Go 1.11beta1: go vet prints output twice cmd/vet: errors printed twice Jul 5, 2018
@agnivade agnivade added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 5, 2018
@agnivade agnivade added this to the Go1.11 milestone Jul 5, 2018
@agnivade
Copy link
Contributor

agnivade commented Jul 5, 2018

/cc @alandonovan @mvdan

@agnivade
Copy link
Contributor

agnivade commented Jul 5, 2018

Likely a duplicate of #26125

@robpike
Copy link
Contributor

robpike commented Jul 5, 2018

Duplicate of #26125

@robpike robpike closed this as completed Jul 5, 2018
@robpike robpike marked this as a duplicate of #26125 Jul 5, 2018
@thaJeztah
Copy link
Contributor Author

ah, thanks! subscribing to that one

@golang golang locked and limited conversation to collaborators Jul 5, 2019
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

4 participants