Closed
Description
What version of Go are you using (go version
)?
$ gotip version go version devel +8ed438c07 Mon Mar 15 20:48:37 2021 +0000 darwin/amd64
Does this issue reproduce with the latest release?
No.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ gotip env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/dmitshur/Library/Caches/go-build" GOENV="/Users/dmitshur/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/dmitshur/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/dmitshur/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/dmitshur/sdk/gotip" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/dmitshur/sdk/gotip/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="devel +8ed438c07 Mon Mar 15 20:48:37 2021 +0000" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/var/folders/zb/5p8cwfhj29gf_m8vdy8ylmlr00jwcj/T/tmp.YEX3UfOo/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zb/5p8cwfhj29gf_m8vdy8ylmlr00jwcj/T/go-build3265915026=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I wrote a program that appears to be correct. It uses signal.Notify
to catch SIGINT signals to prevent default handling but otherwise completely ignore them:
package main
import (
"os"
"os/signal"
"time"
)
func main() {
signal.Notify(make(chan os.Signal), os.Interrupt) // ignore SIGINT
time.Sleep(10 * time.Second)
}
Then ran gotip vet .
on it.
What did you expect to see?
No vet report, because as far as I can tell the os.Signal channel doesn't need to be buffered when it's completely unused.
What did you see instead?
$ gotip vet .
# m.test
./main.go:10:2: misuse of unbuffered os.Signal channel as argument to signal.Notify