Skip to content

revive dot-imports allowedPackages config not recognized #4321

@StephenBrown2

Description

@StephenBrown2

Welcome

Description of the problem

Revive 1.3.5 added a new dot-imports configuration:

allowedPackages: (list of strings) comma-separated list of allowed dot import packages

PR: mgechev/revive#939

However, golangci-lint does not recognize such a configuration, which should have been added when revive was bumped in #4305 .

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.55.2 built with go1.21.5 from (unknown, mod sum: "h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8=") on (unknown)

Configuration

linters:
  disable-all: true
  enable:
    - revive
linters-settings:
  revive:
    rules:
      - name: blank-imports
      - name: context-as-argument
      - name: context-keys-type
      - name: dot-imports
        arguments:
          - allowedPackages:
            - "github.com/onsi/ginkgo"
            - "github.com/onsi/ginkgo/v2"
            - "github.com/onsi/gomega"
      - name: empty-block
      - name: error-naming
      - name: error-return
      - name: error-strings
      - name: errorf
      - name: exported
      - name: increment-decrement
      - name: indent-error-flow
      - name: package-comments
      - name: range
      - name: receiver-naming
      - name: redefines-builtin-id
      - name: superfluous-else
      - name: time-naming
      - name: unexported-return
      - name: unreachable-code
      - name: unused-parameter
        disabled: true
      - name: var-declaration
      - name: var-naming

Go environment

$ go version && go env
go version go1.21.5 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/sbrown/.cache/go-build'
GOENV='/home/sbrown/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/sbrown/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/sbrown/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/usr/lib/golang'
GOSUMDB='off'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/sbrown/lint-dot-imports/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1509626063=/tmp/go-build -gno-record-gcc-switches'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/sbrown/lint-dot-imports /home/sbrown /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 1 linters: [revive]       
INFO [loader] Go packages loading at mode 575 (types_sizes|compiled_files|deps|imports|exports_file|files|name) took 407.777404ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 16.771175ms 
INFO [linters_context/goanalysis] analyzers took 7.011090499s with top 10 stages: the_only_name: 7.007375255s, typecheck: 3.715244ms 
INFO [runner/skip_dirs] Skipped 66 issues from dir locallistener/proto by pattern /proto 
INFO [runner/max_same_issues] 444/447 issues with text "dot-imports: should not use dot imports" were hidden, use --max-same-issues 
INFO [runner] Issues before processing: 617, after processing: 3 
INFO [runner] Processors filtering stat (out/in): nolint: 447/448, diff: 447/447, path_prefixer: 3/3, cgo: 617/617, path_prettifier: 617/617, skip_files: 617/617, identifier_marker: 551/551, exclude-rules: 448/551, fixer: 3/3, autogenerated_exclude: 551/551, uniq_by_line: 447/447, max_per_file_from_linter: 447/447, severity-rules: 3/3, sort_results: 3/3, filename_unadjuster: 617/617, skip_dirs: 551/617, exclude: 551/551, max_same_issues: 3/447, max_from_linter: 3/3, source_code: 3/3, path_shortener: 3/3 
INFO [runner] processing took 47.595657ms with stages: nolint: 32.963607ms, exclude-rules: 6.36468ms, identifier_marker: 3.90755ms, autogenerated_exclude: 1.916815ms, path_prettifier: 1.810441ms, skip_dirs: 461.643µs, uniq_by_line: 63.65µs, cgo: 35.95µs, max_same_issues: 28.04µs, source_code: 15.886µs, filename_unadjuster: 14.493µs, max_per_file_from_linter: 10.029µs, path_shortener: 827ns, max_from_linter: 573ns, skip_files: 383ns, fixer: 262ns, exclude: 211ns, sort_results: 200ns, diff: 184ns, severity-rules: 168ns, path_prefixer: 65ns 
INFO [runner] linters took 586.633822ms with stages: goanalysis_metalinter: 538.993494ms 
registration/registration_suite_test.go:6:2: dot-imports: should not use dot imports (revive)
        . "github.com/onsi/ginkgo"
        ^
registration/registration_suite_test.go:7:2: dot-imports: should not use dot imports (revive)
        . "github.com/onsi/gomega"
        ^
apfs/apfs_suite_test.go:6:2: dot-imports: should not use dot imports (revive)
        . "github.com/onsi/ginkgo"
        ^
INFO File cache stats: 2 entries of total size 394B 
INFO Memory: 12 samples, avg is 203.3MB, max is 500.1MB 
INFO Execution took 1.015271767s

A minimal reproducible example or link to a public repository

package main

import (
	"fmt"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

func main() {
	fmt.Println("Hello, 世界")
}

Validation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions