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: exits with code 0 after outputting warning (should exit with 1) #7017

Closed
gopherbot opened this issue Dec 26, 2013 · 2 comments
Closed

cmd/vet: exits with code 0 after outputting warning (should exit with 1) #7017

gopherbot opened this issue Dec 26, 2013 · 2 comments
Assignees

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 26, 2013

by ej@evanjones.ca:

The go vet docs state: "Its exit code is 2 for erroneous invocation of the tool, 1
if a problem was reported, and 0 otherwise." However, the command only ever returns
0 or 2. I tested both with go1.2 and go version devel +9963a911bc14 Thu Dec 26 13:03:30
2013 -0800 darwin/amd64. See the commands below.

Result:
* Exit code success: 0
* Exit code after warning: 0 (SHOULD BE 1)
* Exit code with bad flags: 2



example.go:

package main

import (
    "fmt"
    "go/ast"
)

func main() {
    c := ast.Comment{0, "text"}
    fmt.Println("c: ", c)
}



Commands:

Yoho:~ ej$ go version
go version go1.2 darwin/amd64
Yoho:~ ej$ go vet example.go; echo "CODE: $?"
example.go:9: go/ast.Comment composite literal uses unkeyed fields
CODE: 0
Yoho:~ ej$ go vet -bad example.go &> /dev/null; echo "CODE: $?"
CODE: 2
Yoho:~ ej$ go tool vet example.go; echo "CODE: $?"
example.go:9: go/ast.Comment composite literal uses unkeyed fields
CODE: 0
Yoho:~ ej$ /usr/local/go/pkg/tool/darwin_amd64/vet example.go; echo "CODE: $?"
example.go:9: go/ast.Comment composite literal uses unkeyed fields
CODE: 0
@rsc

This comment has been minimized.

Copy link
Contributor

@rsc rsc commented Mar 3, 2014

Comment 1:

Owner changed to @robpike.

Status changed to Accepted.

@robpike

This comment has been minimized.

Copy link
Contributor

@robpike robpike commented Mar 7, 2014

Comment 2:

This issue was closed by revision golang/tools@95c9b7b.

Status changed to Fixed.

@gopherbot gopherbot added the fixed label Mar 7, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.