golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.88k stars 17.52k forks source link

go help exit code 2 #39770

Closed hellojukay closed 4 years ago

hellojukay commented 4 years ago

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

go version go1.13.6 linux/amd64

Does this issue reproduce with the latest release?

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

go env Output
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/hellojukay/.cache/go-build"
GOENV="/home/hellojukay/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
components,git-biz.qianxin-inc.cn/ats-ng/nspm-2.0"
GOOS="linux"
GOPATH="/home/hellojukay/go"
GOPROXY="https://goproxy.io"
GOROOT="/home/hellojukay/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/hellojukay/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/dev/null"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build902988545=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go -h | grep build

What did you expect to see?

it should get help usage about build

    build       compile packages and dependencies
    buildmode   build modes
    cache       build and test caching

What did you see instead?

build golang print usage to stderr,

go -h 
echo $?
2

it thank go -h should exit 0

davecheney commented 4 years ago

The go command returned -2 because -h is not recognised.

hellojukay commented 4 years ago

yes , go help exit with 0