Skip to content

Killed Error: golangci-lint exit with code 137 #1094

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

Closed
3 tasks done
YakDriver opened this issue Aug 27, 2024 · 3 comments
Closed
3 tasks done

Killed Error: golangci-lint exit with code 137 #1094

YakDriver opened this issue Aug 27, 2024 · 3 comments
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@YakDriver
Copy link

YakDriver commented Aug 27, 2024

Welcome

  • Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Description of the problem

Relates #552

How important is it that the Go version used to run golangci-lint is the same as the Go version used by the project?

When attempting to upgrade to Go v1.23.0:

Killed

Error: golangci-lint exit with code 137

Version of golangci-lint

v1.59.1

Version of the GitHub Action

v6.1.0

Workflow file

name: golangci-lint Checks

on:
  push:
    branches:
      - main
      - 'release/**'
  pull_request:
    paths:
      - .github/workflows/golangci-lint.yml
      - .ci/.golangci*.yml
      - .ci/tools/**
      - internal/**
      - go.sum
      - main.go
      - names/**
      - tools/**

jobs:
  golangci-lintb:
    name: 2 of 3
    runs-on: custom-linux-xl
    steps:
      - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
      - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
        with:
          go-version-file: go.mod
          cache: false
      - id: golangci-lint-version
        working-directory: .ci/tools
        run: >-
          echo "version=$(
            go list -m all |
            grep github.com/golangci/golangci-lint |
            awk '{print $2}'
          )" >> $GITHUB_OUTPUT
      - name: golangci-lint
        uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
        with:
          version: "${{ steps.golangci-lint-version.outputs.version }}"
          args: --config .ci/.golangci2.yml
        env:
          GOGC: "200" # tried values between 5 and 3000 and same result

Golangci-lint configuration

issues:
  max-per-linter: 10 # attempt at reducing memory
  max-same-issues: 2 # attempt at reducing memory
  concurrency: 4 # attempt at reducing memory
  go: 1.23

linters:
  disable-all: true
  enable:
    - asasalint
    - asciicheck
    - containedctx
    - contextcheck
    - copyloopvar
    - dogsled
    - durationcheck
    - errcheck
    - errname
    - errorlint
    - goconst
    - gocritic
    - gofmt
    - gosimple
    - govet
    - ineffassign
    - makezero
    - misspell
    - mnd

linters-settings:
  copyloopvar:
    check-alias: true
  dogsled:
    max-blank-identifiers: 3
  errcheck:
    ignore: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set
    # "ignore" is deprecated but "exclude-functions" doesn't seem to work or the syntax is non-obvious.
    # https://github.com/kisielk/errcheck#excluding-functions
    # Under exclude-functions are the various attempts at getting it to work, all of which result in d.Set being linted everywhere.
    # exclude-functions:
    #   - github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set
    #   - github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.ResourceData.Set
    #   - github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set,io:Close
    #   - (github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.ResourceData).Set
    #   - github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set
    #   - github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew
    #   - github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:Set
    #   - github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.Set
  errorlint:
    errorf: false
  goconst:
    ignore-tests: true
    min-occurrences: 6
  gocritic:
    enabled-tags:
      - diagnostic
    disabled-tags:
      - experimental
      - opinionated
      - performance
      - style
  mnd:
    checks:
      - argument
    ignored-functions:
      - aws.Int32
      - aws.Int64
      - request.ConstantWaiterDelay
      - request.WithWaiterMaxAttempts
      - nullable.*
      - tfresource.Retry*
      - tfresource.With*
      - retry.RetryContext
      - schema.DefaultTimeout
      - validation.*
      - int64validator.*
      - listvalidator.*
      - setvalidator.*
      - stringvalidator.*
      - SetDefaultCreateTimeout
      - SetDefaultReadTimeout
      - SetDefaultUpdateTimeout
      - SetDefaultDeleteTimeout
      - make
      - strconv.FormatFloat
      - strconv.FormatInt
      - strconv.ParseFloat
      - strconv.ParseInt
      - strings.SplitN

run:
  timeout: 75m

Go version

v1.23.0

Code example or link to a public repository

HashiCorp Terraform AWS Provider

@ldez ldez added the duplicate This issue or pull request already exists label Aug 27, 2024
@YakDriver
Copy link
Author

YakDriver commented Aug 27, 2024

Unfortunately, upgrading golangci-lint to v1.60.3 did not fix the issue and I still get:

  Killed
  
  Error: golangci-lint exit with code 137
  Ran golangci-lint in 296885ms

This is confusing because locally I had updated golangci-lint to v1.60.3 and it ran fine. However, in the GitHub workflow, we rely on go.mod for the .ci module and it was still set to v1.59.1. But, even after upgrading it to v1.60.3, which supports Go v1.23.0, I get the same unhelpful message, "Killed."

Update: Solution found!

Fixing this required two pieces:

  1. Upgrading to golangci-lint v1.60.0+
  2. Playing with GOGC in the workflow file -- too high and I get "Killed", too low and it runs really slow
      - name: golangci-lint
        uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
        with:
          version: "1.60.3"
          args: --config .ci/.golangci3.yml
        env:
          GOGC: "100" # default

@ldez ldez added the question Further information is requested label Aug 27, 2024
@ldez ldez closed this as completed Aug 27, 2024
@ozancaglayan
Copy link

Hi.

Same here. Its not only the action, I also get the memory issues locally on my computer. My golangci-lint is 1.60.3 compiled with go 1.23.

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

Is there a solution that I'm missing?

Thanks!

@ldez
Copy link
Member

ldez commented Aug 28, 2024

You are on the Github Action repo.

If you have a reproducible context, please open an issue on the golangci-lint repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants