beats icon indicating copy to clipboard operation
beats copied to clipboard

golangci-lint action incorrectly abuses GOOS to get cross-platform linting

Open efd6 opened this issue 1 year ago • 1 comments

The current golangci-lint action configuration uses GOOS to try to lint on platforms other than the OS that the builder is running on.

    strategy:
      matrix:
        include:
          - GOOS: windows
          - GOOS: linux
          - GOOS: darwin
    name: lint
    runs-on: ubuntu-latest

This has the effect that when the analyser runs it may be in a situation where it cannot get all the required type information to be able to complete the analysis. Unfortunately, in this situation it does not simply fail, but emits incorrect linter advice that people then try to fix.

The situation where this most commonly will happen is when the build includes Cgo dependencies, as beats do.

The correct approach would be to use the Multiple OS Support provided by the action.

efd6 avatar May 16 '24 03:05 efd6

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

elasticmachine avatar May 16 '24 03:05 elasticmachine

Hi! We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

botelastic[bot] avatar May 16 '25 04:05 botelastic[bot]