Skip to content

GCI chokes on math/rand/v2 #4415

Closed
Closed
@andig

Description

@andig

Welcome

Description of the problem

Importing math/rand/v2, GCI wants the import in the second, no-standard-library, import block which is wrong:

  Running [/home/runner/golangci-lint-1.56.2-linux-amd64/golangci-lint run --out-format=colored-line-number,github-actions --timeout 5m] in [] ...
  provider/mqtt/client.go:6: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
  	"math/rand/v2"
  provider/mqtt/client.go:15: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
  	"github.com/evcc-io/evcc/util/request"
  hems/ocpp/ocpp.go:5: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
  	"math/rand/v2"
  Error: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
  Error: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
  Error: File is not `gci`-ed with --skip-generated -s standard -s default (gci)

Running with --fix produces imports like:

	"fmt"
	"strings"
	"time"

	"github.com/evcc-io/evcc/api"
	"github.com/evcc-io/evcc/core/site"
	"github.com/evcc-io/evcc/hems/ocpp/profile"
	"github.com/evcc-io/evcc/util"
	"github.com/evcc-io/evcc/util/machine"
	ocpp16 "github.com/lorenzodonini/ocpp-go/ocpp1.6"
	ocppcore "github.com/lorenzodonini/ocpp-go/ocpp1.6/core"
	"github.com/lorenzodonini/ocpp-go/ws"
	"math/rand/v2" // <-- doesn't belong there

Reproed locally, so not depending on action.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.56.2 built with go1.22.0 from 58a724a on 2024-02-15T12:52:06Z

Configuration

.

Go environment

$ go version && go env
go version go1.22.0 darwin/arm64
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/andig/Library/Caches/go-build'
GOENV='/Users/andig/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/andig/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/andig/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.0/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.0/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/andig/htdocs/evcc/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build1340198295=/tmp/go-build -gno-record-gcc-switches -fno-common'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

A minimal reproducible example or link to a public repository

evcc-io/evcc@ad0c6d5

Validation

  • Yes, I've included all information above (version, config, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdependenciesRelates to an upstream dependency

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions