Skip to content

ERRO Running error: context loading failed: no go files to analyze #4168

Closed
@aine-etke

Description

@aine-etke

Welcome

Description of the problem

Running golangci-lint run ./... inside the root of the https://gitlab.com/etke.cc/mrs/api project fails with the error:

ERRO Running error: context loading failed: no go files to analyze

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.55.1 built with go1.21.3 from 9b20d49d on 2023-10-25T10:03:43Z

Configuration

run:
  concurrency: 4
  timeout: 5m
  issues-exit-code: 1
  tests: true
  build-tags: []
  skip-dirs: []
  skip-dirs-use-default: true
  skip-files: []
  modules-download-mode: readonly
  allow-parallel-runners: false

output:
  format: colored-line-number
  print-issued-lines: true
  print-linter-name: true
  uniq-by-line: true
  path-prefix: ""
  sort-results: true

linters-settings:
  errcheck:
    check-blank: true
  gocognit:
    min-complexity: 15
  nestif:
    min-complexity: 4
  gocritic:
    enabled-tags:
      - performance
  gofumpt:
    lang-version: "1.18"
  gosimple:
    go: "1.18"
    checks: [ "all" ]
  govet:
    check-shadowing: true
    enable:
      - atomicalign
      - shadow
  misspell:
    locale: US
  staticcheck:
    go: "1.18"
    checks: [ "all" ]
  stylecheck:
    go: "1.18"
  unparam:
    check-exported: true
  unused:
    go: "1.18"
  gci:
    sections:
      - standard
      - default
      - prefix(gitlab.com/etke.cc/mrs/api)
    section-separators:
      - newLine
linters:
  disable-all: false
  enable:
    - megacheck
    - govet
    - errcheck
    - gci
    - gocognit
    - nestif
    - gocritic
    - gofumpt
    - goimports
    - gosimple
    - govet
    - misspell
    - staticcheck
    - stylecheck
    - unparam
    - unused
  fast: false


issues:
  exclude-rules:
    - path: _test\.go
      linters:
        - gocyclo
        - errcheck
        - dupl
        - gosec
    - linters:
        - staticcheck
      text: "SA9003:"
    - linters:
        - lll
      source: "^//go:generate "
  max-issues-per-linter: 0
  max-same-issues: 0
  new: false

Go environment

$ go version && go env
go version go1.21.3 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/user/projects/etke.cc/mrs/api/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-build3766158995=/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/user/projects/etke.cc/mrs/api /home/user/projects/etke.cc/mrs /home/user/projects/etke.cc /home/user/projects /home/user /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 15 linters: [errcheck gci gocognit gocritic gofumpt goimports gosimple govet ineffassign misspell nestif staticcheck stylecheck unparam unused] 
INFO [loader] Go packages loading at mode 575 (types_sizes|deps|files|name|compiled_files|exports_file|imports) took 73.050549ms 
ERRO Running error: context loading failed: no go files to analyze 
INFO Memory: 2 samples, avg is 25.3MB, max is 27.3MB 
INFO Execution took 76.012364ms 

A minimal reproducible example or link to a public repository

https://gitlab.com/etke.cc/mrs/api

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