golang/go

cmd/vet: spurious "context leak" due to imprecise 'defer' control-flow analysis in lostcancel

Ouverte

#25 720 ouverte le 4 juin 2018

 (13 commentaires) (0 réaction) (0 personne assignée)Go (19 008 forks)batch import
AnalysisNeedsFixhelp wanted

Métriques du dépôt

Stars
 (133 883 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10 windows/amd64

Does this issue reproduce with the latest release?

yes, tested on go1.10.2 as well

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

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\micro\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=F:\goenv\
set GORACE=
set GOROOT=F:\go
set GOTMPDIR=
set GOTOOLDIR=F:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\micro\AppData\Local\Temp\go-build748724598=/tmp/go-build -gno-record-gcc-switches

What did you do?

run go vet on https://play.golang.org/p/X_vRJbYf7rO

What did you expect to see?

no errors

What did you see instead?

issue.go:12: the cancel function is not used on all paths (possible context leak)
issue.go:14: this return statement may be reached without using the cancel var defined on line 12

Guide contributeur