Closed
Description
Thank you for creating the issue!
- Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
- Yes, I've searched similar issues on GitHub and didn't find any.
- Yes, I've included all information below (version, config, etc).
Please include the following information:
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version v1.23.6 built from (unknown, mod sum: "h1:dxnT1QFIpTeVoFUPaVDeFJJ+To++8ANYsQ2JIxJY02s=") on (unknown)
Config file
$ cat .golangci.yml
no file
Go environment
$ go version && go env
go version go1.14 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/lol/.cache/go-build"
GOENV="/home/lol/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/lol/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build142025697=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint run -v --enable-all
INFO [config_reader] Config search paths: [./ /dev/shm /dev /]
INFO [lintersdb] Active 41 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gomnd goprintffuncname gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc rowserrcheck scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace wsl]
INFO [lintersdb] Active 41 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gomnd goprintffuncname gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc rowserrcheck scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace wsl]
INFO [loader] Go packages loading at mode 575 (deps|exports_file|files|imports|compiled_files|types_sizes|name) took 79.000942ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 227.914µs
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 0s with no stages
INFO [runner/unused/goanalysis] analyzers took 0s with no stages
INFO [runner] Processors filtering stat (out/in): diff: 1/1, max_same_issues: 1/1, identifier_marker: 1/1, filename_unadjuster: 1/1, path_prettifier: 1/1, skip_dirs: 1/1, max_from_linter: 1/1, path_shortener: 1/1, cgo: 1/1, skip_files: 1/1, uniq_by_line: 1/1, nolint: 1/1, max_per_file_from_linter: 1/1, source_code: 1/1, autogenerated_exclude: 1/1, exclude: 1/1, exclude-rules: 1/1
INFO [runner] processing took 223.729µs with stages: nolint: 62.805µs, exclude: 60.52µs, identifier_marker: 35.976µs, autogenerated_exclude: 17.415µs, source_code: 15.787µs, path_prettifier: 14.253µs, skip_dirs: 6.434µs, uniq_by_line: 2.908µs, max_same_issues: 1.875µs, cgo: 1.313µs, max_from_linter: 1.038µs, path_shortener: 995ns, max_per_file_from_linter: 765ns, filename_unadjuster: 728ns, diff: 405ns, exclude-rules: 303ns, skip_files: 209ns
INFO [runner] linters took 40.375115ms with stages: goanalysis_metalinter: 39.761763ms, unused: 322.148µs
main.go:15:2: Consider preallocating `a` (prealloc)
var (
^
INFO File cache stats: 1 entries of total size 288B
INFO Memory: 3 samples, avg is 68.9MB, max is 68.9MB
INFO Execution took 128.038057ms
source code
package main
import (
"fmt"
"math/rand"
)
const maxNew = 100
func other() []int {
return make([]int, rand.Int63()%maxNew)
}
func main() {
var (
a []int
b = []int{1, 2, 3, 4, 5}
)
for range b {
a = append(a, other()...)
}
fmt.Printf("a: %d\nb: %d\n", len(a), len(b))
}