Skip to content

Having trouble setting an env variable #226

@patrickdevivo

Description

@patrickdevivo

Hi! I'm trying to use this GitHub action, but need to have the CGO_LDFLAGS env var set when the golangci-lint command runs (along with some build flags, which I supply via the args option).

I've noticed that setting the env like so:

  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          version: latest
          args: --build-tags libsqlite3,sqlite_json1
        env:
          CGO_LDFLAGS: "-Wl,--unresolved-symbols=ignore-in-object-files"

Doesn't seem to work for me. The go env output in the GitHub actions UI does suggest that CGO_LDFLAGS is set properly, however the lint step fails with an error that suggests it was not set when the command runs (it times out, which is the same behavior on my machine when that particular flag is not set).

Looking in the code, I see this line which suggests to me, according to the docs here that the process should just inherit the env var, but perhaps I'm missing something.

Does anyone have any ideas or may have encountered this before?

Thanks so much

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