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

SA5009: potential false-positive for byte arrays #714

Closed
vcabbage opened this issue Mar 24, 2020 · 1 comment
Closed

SA5009: potential false-positive for byte arrays #714

vcabbage opened this issue Mar 24, 2020 · 1 comment

Comments

@vcabbage
Copy link

vcabbage commented Mar 24, 2020

staticcheck -version: build from master c702d0a
staticcheck -debug.version:

staticcheck (no version)

Compiled with Go version: go1.14
Main module:
        honnef.co/go/tools
Dependencies:
        github.com/BurntSushi/[email protected] (sum: h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=)
        golang.org/x/[email protected] (sum: h1:/iIZNFGxc/a7C3yWjGcnboV+Tkc7mxr+p6fDztwoxuM=)

go version: go version go1.14 linux/amd64
go env:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/kale/.cache/go-build"
GOENV="/home/kale/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=[redacted]
GONOSUMDB=[redacted]
GOOS="linux"
GOPATH="/home/kale/go"
GOPRIVATE=[redacted]
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/kale/goroots/go1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/kale/goroots/go1.14/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/kale/go/src/honnef.co/go/tools/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 -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build160255903=/tmp/go-build -gno-record-gcc-switches"

Command: staticcheck
Output:

main.go:8:13: Printf format %s has arg #1 of wrong type [4]byte (SA5009)

Playground: https://play.golang.org/p/aHfAniNvlEo


Using %s to format byte arrays isn't documented in the fmt package as far as I can tell. There is logic and tests for it though.

@vcabbage vcabbage added false-positive needs-triage Newly filed issue that needs triage labels Mar 24, 2020
@dominikh dominikh removed the needs-triage Newly filed issue that needs triage label Mar 26, 2020
@dominikh
Copy link
Owner

Nice catch. Will fix.

@dominikh dominikh added this to the v2020.2 milestone Mar 26, 2020
@dominikh dominikh added the started Issues we've started working on label May 10, 2020
@dominikh dominikh removed the started Issues we've started working on label May 10, 2020
dominikh added a commit that referenced this issue Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants