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

golangci-lint go list seemingly recompiles go-sqlite3 everytime an lsp is connected #5010

Closed
6 of 7 tasks
hjkatz opened this issue Sep 12, 2024 · 14 comments
Closed
6 of 7 tasks
Assignees
Labels
question Further information is requested

Comments

@hjkatz
Copy link

hjkatz commented Sep 12, 2024

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

Description of the problem

Everytime I load neovim with golangci-lint-langserver I see processes trying to compile cgo versions of go-sqlite3 for our project (which includes this dep btw).

I can't quite figure out why go list would be doing this, so I thought I'd ask.

I'm noticing this happens when directly running golangci-lint run too.

I see processes like this running when golangci-lint run starts:

hkatz    2803292  0.0  0.0 229640  3584 pts/1    S+   15:39   0:00 /nix/store/skkw2fidr9h2ikq8gzgfm6rysj1mal0r-gcc-13.2.0/bin/gcc -fPIC -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong --param ssp-buffer-size=4 -fno-strict-overflow -I /opt/ngrok/.cache/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.17 -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2317379404/b629=/tmp/go-build -gno-record-gcc-switches -I /tmp/go-build2317379404/b629/ -O2 -g -std=gnu99 -DSQLITE_ENABLE_RTREE -DSQLITE_THREADSAFE=1 -DHAVE_USLEEP=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_TRACE_SIZE_LIMIT=15 -DSQLITE_OMIT_DEPRECATED -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -Wno-deprecated-declarations -DHAVE_PREAD64=1 -DHAVE_PWRITE64=1 -I/opt/ngrok/.cache/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.17 -ffile-prefix-map=/opt/ngrok/.cache/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.17=/_/github.com/mattn/go-sqlite3@v1.14.17 -frandom-seed=V9o1hsdxHnWsi0hvLBRx -o /tmp/go-build2317379404/b629/_x012.o -c sqlite3-binding.c -B/nix/store/r8qsxm85rlxzdac7988psm7gimg4dl3q-glibc-2.39-52/lib/ -idirafter /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include -idirafter /nix/store/skkw2fidr9h2ikq8gzgfm6rysj1mal0r-gcc-13.2.0/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/include-fixed -B/nix/store/qksd2mz9f5iasbsh398akdb58fx9kx6d-gcc-13.2.0-lib/lib -B/nix/store/yc9q0h72rlj98y0116c4mma6k80264mv-gcc-wrapper-13.2.0/bin/ -frandom-seed=gw9h5mrrmq
hkatz    2808233 69.0  1.0 569864 344492 pts/1   R+   15:40   0:01 /nix/store/yc9q0h72rlj98y0116c4mma6k80264mv-gcc-wrapper-13.2.0/bin/as -I /opt/ngrok/.cache/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.17 -I /tmp/go-build2317379404/b629/ -I /opt/ngrok/.cache/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.17 --gdwarf-5 --64 -o /tmp/go-build2317379404/b629/_x012.o /tmp/cctqNNx7.s

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.60.3 built with go1.23.0 from (unknown, modified: ?, mod sum: "h1:l38A5de24ZeDlcFF+EB7m3W5joPD99/hS5SIHJPyZa0=") on (unknown)

Build from source because we use a custom plugin. I have the plugin disabled for the purposes of this bug report.

Configuration

---
  # This file contains all available configuration options
  # with their default values.

  # options for analysis running
  run:
    # default concurrency is a available CPU number
    # concurrency: 2

    # Timeout for analysis, e.g. 30s, 5m.
    # Default: 1m
    timeout: 10m

    # exit code when at least one issue was found, default is 1
    issues-exit-code: 1

    allow-parallel-runners: true

    # include test files or not, default is true
    tests: true

    # list of build tags, all linters use it. Default is empty list.
    # build-tags:
    #   - mytag

    # which files to skip: they will be analyzed, but issues from them
    # won't be reported. Default value is empty list, but there is
    # no need to include all autogenerated files, we confidently recognize
    # autogenerated files. If it's not please let us know.
    # skip-files:
    #   - ".*\\.my\\.go$"
    #   - lib/bad.go


  # output configuration options
  output:
    # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
    formats:
      - format: colored-line-number

    # print lines of code with issue, default is true
    print-issued-lines: true

    # print linter name in the end of issue text, default is true
    print-linter-name: true


  # all available settings of specific linters
  linters-settings:
    errcheck:
      # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
      # default is false: such cases aren't reported by default.
      check-type-assertions: false

      # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
      # default is false: such cases aren't reported by default.
      check-blank: false

      # List of functions to exclude from checking, where each entry is a single function to exclude.
      # See https://github.com/kisielk/errcheck#excluding-functions for details.
      exclude-functions:
      - (net.Conn).SetDeadline
      - (*net/http.Response).Write
      - (*database/sql.Tx).Rollback
      - (github.com/inconshreveable/olive.Response).Encode
    govet: {}
    gofmt:
      # simplify code: gofmt with `-s` option, true by default
      simplify: false
    gosec:
      excludes:
      - G204 # possibly untrusted cmd args, false positive rate in our codebase
      - G306 # file perms, low signal
      - G404 # weak rng, high false positive rate
      - G601 # invalid as of go1.22 https://github.com/securego/gosec/issues/1099
      - G115 # integer overflow, lots of false positives in our codebase
    gomodguard:
      blocked:
        local_replace_directives: true
    goimports:
      # put imports beginning with prefix after 3rd-party packages;
      # it's a comma-separated list of prefixes
      local-prefixes: go.ngrok.com
    gocyclo:
      # minimal code complexity to report, 30 by default (but we recommend 10-20)
      min-complexity: 10
    dupl:
      # tokens count to trigger issue, 150 by default
      threshold: 100
    goconst:
      # minimal length of string constant, 3 by default
      min-len: 3
      # minimal occurrences count to trigger, 3 by default
      min-occurrences: 3
    depguard:
      rules:
        no-spew:
          list-mode: lax
          files:
          - "$all"
          deny:
          - pkg: "github.com/davecgh/go-spew/spew"
            desc: "Copied from previous config, don't spew"
        # This will match all non-test files
        no-testkit-imports-outside-test-files:
          list-mode: lax
          files:
          - "$all"                 # Start with all files
          - "!$test"               # Exclude test files, they can include testkit
          - "!**/mocks/mocks.go"   # Exclude mocks, they can include testkit
          - "!**/lib/testkit/**"   # Exclude testkit itself and subpackages
    misspell:
      # Correct spellings using locale preferences for US or UK.
      # Default is to use a neutral variety of English.
      # Setting locale to US will correct the British spelling of 'colour' to 'color'.
      locale: US
      ignore-words:
      - cancelled
      - behaviour
      - marshalling
      - substituters # `substituters` is a misspelling of `substitutes` according to this lint -_-
      - favourites
    lll:
      # max line length, lines longer will be reported. Default is 120.
      # '\t' is counted as 1 character by default, and can be changed with the tab-width option
      line-length: 120
      # tab width in spaces. Default to 1.
      tab-width: 1
    unused: {}
    unparam:
      # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
      # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
      # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
      # with golangci-lint call it on a directory with the changed file.
      check-exported: false
    nakedret:
      # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
      max-func-lines: 30
    prealloc:
      # XXX: we don't recommend using this linter before doing performance profiling.
      # For most programs usage of prealloc will be a premature optimization.

      # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
      # True by default.
      simple: true
      range-loops: true  # Report preallocation suggestions on range loops, true by default
      for-loops: false  # Report preallocation suggestions on for loops, false by default
    revive:
      ignore-generated-header: true
      severity: warning
      rules:
        - name: blank-imports
        # - name: context-as-argument
        - name: dot-imports
        - name: error-return
        - name: error-strings
        - name: error-naming
        # - name: exported
        # - name: if-return
        - name: increment-decrement
        # - name: var-naming
        - name: package-comments
        - name: range
        # - name: receiver-naming
        # - name: unexported-return
        - name: indent-error-flow
        # - name: empty-block
        - name: superfluous-else
        # - name: unused-parameter
        - name: unreachable-code
        # - name: redefines-builtin-id
        # Skipped for performance reasons / to avoid logspam, see: https://github.com/golangci/golangci-lint/issues/2997
        # - context-keys-type
        # - errorf
        # - time-naming
        # - var-declaration
    custom:
      # Custom linter
      custom-lints:
        type: goplugin
        path: ./.golang-ci/plugins/lints.so
        description: "custom lints"
        original-url: example/.../lints/plugin.go

  linters:
    # enable-all: false
    # disable:
    #   - maligned
    #   - prealloc
    # presets:
    #   - bugs
    #   - unused
    fast: false
    disable-all: true
    enable:
      - depguard
      - errcheck
      - gofmt
      - goimports
      - gomodguard
      - gosec
      - govet
      - ineffassign
  #    - interfacer
  #    - megacheck
      - misspell
  #   - prealloc
      - revive
      - typecheck
      - unconvert
  #    - unparam
      - staticcheck# - ngrok-lints
      - unused


  issues:
    # List of regexps of issue texts to exclude, empty list by default.
    # But independently from this option we use default exclude patterns,
    # it can be disabled by `exclude-use-default: false`. To list all
    # excluded by default patterns execute `golangci-lint run --help`
    exclude:
      # All of the below deprecations are part of dynamic backends and should be handled once dynamic backends is enabled
      - ".Hostname is deprecated"
      - ".Proto is deprecated"
      - ".URL is deprecated"
      - ".GetURL is deprecated"
      - ".GetProto is deprecated"
      - ".Hostname is deprecated"
      - ".Auth is deprecated"
      # -- end dynamic backends deprecations --
      - "Subprocess launched with function call as argument or cmd arguments"
      - "\\+= 1"
      - "\\-= 1"
      - "a blank import should be only in a main or test package"
      - "composite literal uses unkeyed fields"
      - "drop this else and outdent"
      - "jsonpb.JSONPBMarshaler is deprecated" # We know, but we're putting off migrating
      - "jsonpb.JSONPBUnmarshaler is deprecated" # We know, but we're putting off migrating
      - "\"github.com/golang/protobuf/jsonpb\" is deprecated" # We know, we'll get to it
      - "\"github.com/golang/protobuf/proto\" is deprecated" # We know, but it's not a drop-in replacement
      - "\"github.com/golang/protobuf/protoc-gen-go/generator\" is deprecated" # ''
      - ".RawRequestWithContext is deprecated" # We need to refactor our vault client for this 

    # which dirs to skip: they won't be analyzed;
    # can use regexp here: generated.*, regexp is applied on full path;
    # default value is empty list, but next dirs are always skipped independently
    # from this option's value:
    #     vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
    exclude-dirs:
    - lib/netx/httpx/httputilx # vendored in from upstream

    exclude-rules:
      # Exclude some linters from running on tests files.
      - path: cmd/custom
        linters:
          - errcheck
      - path: svc
        linters:
          - errcheck
      - path: _test\.go
        linters:
          - errcheck
          - gosec
      - path: _test\.go
        linters:
         - custom-lints
        text: "custom_lint_errs:"

      - path: svc/e2e/tests
        linters:
          - errcheck
          - gosec
      - path: svc/api/tests
        linters:
        - custom-lints


    # Independently from option `exclude` we use default exclude patterns,
    # it can be disabled by this option. To list all
    # excluded by default patterns execute `golangci-lint run --help`.
    # Default value for this option is true.
    exclude-use-default: true

    # Maximum issues count per one linter.
    # Set to 0 to disable.
    # Default: 50
    max-issues-per-linter: 0

    # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
    max-same-issues: 0

    # Show only new issues: if there are unstaged changes or untracked files,
    # only those changes are analyzed, else only changes in HEAD~ are analyzed.
    # It's a super-useful option for integration of golangci-lint into existing
    # large codebase. It's not practical to fix all existing issues at the moment
    # of integration: much better don't allow issues in new code.
    # Default is false.
    new: false

    # # Show only new issues created after git revision `REV`
    # new-from-rev: REV

    # # Show only new issues created in git patch with set file path.
    # new-from-patch: path/to/patch/file
~

In neovim I run with args --config path/to/.golangci.yml --out-format json --timeout 30s

Go environment

$ go version && go env
go version go1.23.1 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/opt/ngrok/.cache/go-build.ca659dpi36lipsy3gi2xp8kw23fq4q45'
GOENV='/home/hkatz/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS='-buildvcs=false -trimpath'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/opt/ngrok/.cache/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/opt/ngrok/.cache/go'
GOPRIVATE=''
GOPROXY='https://dev:4ZbMDQVpz2vSdyNFJX8Bd5aXjGxl1uyk@athens.corp.ngrok.com|https://dev:4ZbMDQVpz2vSdyNFJX8Bd5aXjGxl1uyk@athens.corp.ngrok.com|https://dev:4ZbMDQVpz2vSdyNFJX8Bd5aXjGxl1uyk@athens.corp.ngrok.com|https://proxy.golang.org|direct'
GOROOT='/nix/store/iaf1xfmy998mxpz4d6g8l859hk9hjvzz-go-1.23.1/share/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/nix/store/iaf1xfmy998mxpz4d6g8l859hk9hjvzz-go-1.23.1/share/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.1'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/hkatz/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK='/opt/ngrok/go.work'
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-build3621224031=/tmp/go-build -gno-record-gcc-switches'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
$ golangci-lint run -v
INFO golangci-lint has version v1.60.3 built with go1.23.0 from (unknown, modified: ?, mod sum: "h1:l38A5de24ZeDlcFF+EB7m3W5joPD99/hS5SIHJPyZa0=") on (unknown)
INFO [config_reader] Config search paths: [./ /opt/ngrok/go /opt/ngrok /opt / /home/hkatz]
INFO [config_reader] Used config file .golangci.yml
INFO Loaded ./.golang-ci/plugins/lints.so: ngrok-lints
INFO [lintersdb] Active 13 linters: [depguard errcheck gofmt goimports gomodguard gosec govet ineffassign misspell revive staticcheck unconvert unused]
INFO [loader] Go packages loading at mode 575 (exports_file|files|name|types_sizes|compiled_files|deps|imports) took 1m51.984533297s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 450.334668ms
INFO [linters_context/goanalysis] analyzers took 21m2.645356345s with top 10 stages: buildir: 9m57.440224736s, gosec: 1m16.268705434s, the_only_name: 1m12.633537017s, unconvert: 50.246514182s, unused: 48.49618176s, goimports: 36.378680033s, nilness: 28.297102772s, gofmt: 18.472557014s, inspect: 14.329359368s, fact_deprecated: 12.928784668s
INFO [runner/skip_dirs] Skipped 6 issues from dir third_party/golang.org/x/net/external/socks by pattern (^|/)third_party($|/)
INFO [runner/skip_dirs] Skipped 20 issues from dir cmd/nd/go/lints/printf by pattern cmd/nd/go/lints/printf
INFO [runner/skip_dirs] Skipped 114 issues from dir lib/netx/httpx/httputilx by pattern lib/netx/httpx/httputilx
INFO [runner] Issues before processing: 5889, after processing: 1
INFO [runner] Processors filtering stat (in/out): path_shortener: 1/1, severity-rules: 1/1, cgo: 5889/5889, invalid_issue: 5889/5889, skip_files: 5889/5889, nolint: 51/1, diff: 1/1, max_per_file_from_linter: 1/1, path_prettifier: 5889/5889, skip_dirs: 5889/5749, autogenerated_exclude: 5749/3046, exclude-rules: 2582/51, fixer: 1/1, sort_results: 1/1, identifier_marker: 3046/3046, max_same_issues: 1/1, max_from_linter: 1/1, path_prefixer: 1/1, filename_unadjuster: 5889/5889, exclude: 3046/2582, uniq_by_line: 1/1, source_code: 1/1
INFO [runner] processing took 223.789412ms with stages: exclude: 61.658184ms, identifier_marker: 59.53592ms, autogenerated_exclude: 30.307505ms, path_prettifier: 26.235923ms, exclude-rules: 17.400506ms, nolint: 13.074092ms, skip_dirs: 9.48031ms, invalid_issue: 2.307073ms, cgo: 1.96235ms, filename_unadjuster: 1.802459ms, source_code: 18.275µs, uniq_by_line: 2.625µs, max_same_issues: 1.377µs, path_shortener: 966ns, max_per_file_from_linter: 382ns, skip_files: 310ns, diff: 244ns, fixer: 243ns, sort_results: 231ns, path_prefixer: 175ns, max_from_linter: 174ns, severity-rules: 88ns
INFO [runner] linters took 1m43.051784541s with stages: goanalysis_metalinter: 1m42.827899473s
cmd/nd/ctl/cmd.go:35:103: `behaviours` is a misspelling of `behaviors` (misspell)
			# WARNING: ctl commands are different in controlplane vs. dataplane (different commands, different behaviours)
			                                                                                                   ^
INFO File cache stats: 3851 entries of total size 34.0MiB
INFO Memory: 1815 samples, avg is 2543.2MB, max is 8953.0MB
INFO Execution took 3m35.492638819s
golangci-lint run -v  1475.66s user 88.84s system 724% cpu 3:36.03 total

A minimal reproducible example or link to a public repository

// add your code here

Validation

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

Supporter

@hjkatz hjkatz added the bug Something isn't working label Sep 12, 2024
@ldez ldez self-assigned this Sep 12, 2024
@ldez
Copy link
Member

ldez commented Sep 12, 2024

Hello,

without a reproducible example (outside of the LSP), it's not really possible to diagnose this issue.

@ldez ldez added feedback required Requires additional feedback question Further information is requested and removed bug Something isn't working labels Sep 12, 2024
@hjkatz
Copy link
Author

hjkatz commented Sep 12, 2024

Hello,

Yes, the reproducible example is running golangci-lint.

Would you like something more specific?

@hjkatz
Copy link
Author

hjkatz commented Sep 12, 2024

Eh, I'll be kinder.

I'm really starting this bug report asking if you would know of anything in golangci-lint that does recompiles or cgo builds or something for that wrt a project's dependencies such as go-sqlite3.

@ldez
Copy link
Member

ldez commented Sep 12, 2024

sorry, but you don't provide any reproducible examples.
And nothing without LSP or without the plugin you are using to call the LSP.

golangci-lint doesn't compile.

@hjkatz
Copy link
Author

hjkatz commented Sep 12, 2024

Hmmm... interestingly after I ran golangci-lint cache clean I cannot seem to reproduce.

What happens if the cache is maybe out of sync? I definitely see process trees where sqlite3 is being compiled by golangci-lint

e.g.
image (15)

So perhaps this was a cache miss/hit issue?

@ldez
Copy link
Member

ldez commented Sep 12, 2024

You are seeing a process which calls go list, it's not a compilation.

Without a concrete reproducible example, it's difficult to answer your question.

@hjkatz
Copy link
Author

hjkatz commented Sep 12, 2024

What do you make of this process line then?

/nix/store/skkw2fidr9h2ikq8gzgfm6rysj1mal0r-gcc-13.2.0/bin/gcc -fPIC -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong --param ssp-buffer-size=4 -fno-strict-overflow -I /opt/ngrok/.cache/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.17 -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2317379404/b629=/tmp/go-build -gno-record-gcc-switches -I /tmp/go-build2317379404/b629/ -O2 -g -std=gnu99 -DSQLITE_ENABLE_RTREE -DSQLITE_THREADSAFE=1 -DHAVE_USLEEP=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_TRACE_SIZE_LIMIT=15 -DSQLITE_OMIT_DEPRECATED -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -Wno-deprecated-declarations -DHAVE_PREAD64=1 -DHAVE_PWRITE64=1 -I/opt/ngrok/.cache/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.17 -ffile-prefix-map=/opt/ngrok/.cache/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.17=/_/github.com/mattn/go-sqlite3@v1.14.17 -frandom-seed=V9o1hsdxHnWsi0hvLBRx -o /tmp/go-build2317379404/b629/_x012.o -c sqlite3-binding.c -B/nix/store/r8qsxm85rlxzdac7988psm7gimg4dl3q-glibc-2.39-52/lib/ -idirafter /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include -idirafter /nix/store/skkw2fidr9h2ikq8gzgfm6rysj1mal0r-gcc-13.2.0/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/include-fixed -B/nix/store/qksd2mz9f5iasbsh398akdb58fx9kx6d-gcc-13.2.0-lib/lib -B/nix/store/yc9q0h72rlj98y0116c4mma6k80264mv-gcc-wrapper-13.2.0/bin/ -frandom-seed=gw9h5mrrmq

This is calling gcc - is that not compilation?

@hjkatz
Copy link
Author

hjkatz commented Sep 12, 2024

Now that I'm searching around for go list I ran into these issues:

So perhaps the issue is that golangci-lint is requesting go list with CompiledGoFiles and b/c our project has a dep on go-sqlite3 (which is cgo) it is causing a compile?

@hjkatz
Copy link
Author

hjkatz commented Sep 12, 2024

Are there options in golangci-lint that could allow us to not track/care about CompiledGoFiles? That way I could exclude those during my lsp invocation and keep the settings in our CI invocations.

Here's the go list command I see running:

go list -e -json=Name,ImportPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,CgoFiles,CXXFiles,MFiles,HFiles,FFiles,SFiles,SwigFiles,SwigCXXFiles,SysoFiles,TestGoFiles,XTestGoFiles,CompiledGoFiles,Export,DepOnly,Imports,ImportMap,TestImports,XTestImports -compiled=true -test=true -export=true -deps=true -find=false -pgo=off -- ./...

@ldez
Copy link
Member

ldez commented Sep 12, 2024

Are there options in golangci-lint that could allow us to not track/care about CompiledGoFiles?

There is no option for that.

This call comes from x/tools during the analysis.
Those files are required because of the usage of cgo.

The analysis required the same constraint as a Go compilation to be able to analyze the code.

If you are able to provide a reproducible example, I will be able to have a better diagnostic.

Screenshot

@hjkatz
Copy link
Author

hjkatz commented Sep 12, 2024

Maybe instead of a bug report we can turn this issue into a feature request for disabling cgo analysis or otherwise overriding the -e flag for go list?

What do you think?

@ldez
Copy link
Member

ldez commented Sep 12, 2024

I think I already asked you 3 times a reproducible example.
Despite the requirement of this example inside the issue template, you still not provided it.

@hjkatz
Copy link
Author

hjkatz commented Sep 12, 2024

I'm not sure that you wish to provide any help here.

I'll close out this request in the meantime - and leave it online so future folks can at least search for similar behaviour with cgo.

For now the resolution is to run $ golangci-lint cache clean and it seems the compilation only happens once for cgo, rather than everytime golangci-lint runs.


I think I already asked you 3 times a reproducible example. Despite the requirement of this example inside the issue template, you still not provided it.

In the future I implore you to help your users investigate problems before requiring such a time committment to create a new public GH repo with a smattering of dependencies.

@hjkatz hjkatz closed this as completed Sep 12, 2024
@ldez
Copy link
Member

ldez commented Sep 12, 2024

I'm not sure that you wish to provide any help here.

I'm not sure you were here to get any help.

I asked you a basic thing, several times, and you just ignored it.
And it's not the first issue where you are doing that #4936.

In the future I implore you to help your users investigate problems before requiring such a time committment to create a new public GH repo with a smattering of dependencies.

You don't need to create a repo, you just need to provide the content of some files, a simple example.

In the future, I implore you to follow the issue template and not to ignore comments.

@ldez ldez removed the feedback required Requires additional feedback label Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants