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 shows "killed" immediately #5042

Closed
6 of 7 tasks
tzookb opened this issue Sep 26, 2024 · 6 comments
Closed
6 of 7 tasks

golangci-lint shows "killed" immediately #5042

tzookb opened this issue Sep 26, 2024 · 6 comments
Labels
platform: macos Issue that is related to MacOS question Further information is requested

Comments

@tzookb
Copy link

tzookb commented Sep 26, 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

when I try to run any command for "golangci-lint"
like:

golangci-lint
golangci-lint run .
golangci-lint version
etc...

it shows:

[1]    18319 killed     golangci-lint --version

Version of golangci-lint

$ golangci-lint --version
1.61.0

I cant dump the full content, I just know its the version.

Configuration

# paste configuration file or CLI flags here

Go environment

$ go version && go env

go version go1.21.0 darwin/arm64
GO111MODULE='on'
GOARCH='arm64'
GOBIN='/xxxxxxx/build-support/go/bin'
GOCACHE='/Users/tzookb/Library/Caches/go-build'
GOENV='/Users/tzookb/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS='-modcacherw'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/xxxxxxx/build-support/go/pkg/mod'
GONOPROXY=''
GONOSUMDB='*'
GOOS='darwin'
GOPATH='/xxxxxxx/build-support/go'
GOPRIVATE=''
GOPROXY='https://[email protected]/repository/go'
GOROOT='/xxxxxxx/build-support/go/sdk'
GOSUMDB='off'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/xxxxxxx/build-support/go/sdk/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/4c/xxxxxx/T/go-build2617350968=/tmp/go-build -gno-record-gcc-switches -fno-common'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v

[1]    29434 killed     golangci-lint cache clean

A minimal reproducible example or link to a public repository

/not even checking the code

Validation

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

Supporter

@tzookb tzookb added the bug Something isn't working label Sep 26, 2024
Copy link

boring-cyborg bot commented Sep 26, 2024

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@tzookb
Copy link
Author

tzookb commented Sep 26, 2024

I did try to run the code directly and it gave me a response.
So I built it directly from code with:

GOOS=darwin GOARCH=arm64 go build cmd/golangci-lint/main.go

but then running the executable gave the same "killed" error again

@ldez
Copy link
Member

ldez commented Sep 26, 2024

Hello,

The process can be killed for different reasons:

  • problem with GOOS/ARCH: if the binary is compiled for a specific GOOS/ARCH and used on another tuple.
  • problem with the Go version used to build golangci-lint.
  • problem with memory consumption (in 99% of the case it's related to a problem with the Go version)

But in your case, you must use at least go1.22 to compile golangci-lint.

There is no need for explicit GOOS/ARCH unless you are compiling for another system than yours.

Also, I recommend using our binaries instead of compiling (go install/go run/go build are compilations and not downloads).

https://golangci-lint.run/welcome/install/#binaries

@ldez ldez added question Further information is requested and removed bug Something isn't working labels Sep 26, 2024
@ldez ldez closed this as completed Sep 26, 2024
@tzookb
Copy link
Author

tzookb commented Sep 26, 2024

ended up using this to solve the issue:

https://stackoverflow.com/questions/51833310/what-is-killed9-and-how-to-fix-in-macos-terminal

codesign --sign - --force --preserve-metadata=entitlements,requirements,flags,runtime /path-to/golangci-lint

@jmoody
Copy link

jmoody commented Oct 9, 2024

This is also happening to me. It started two weeks ago. It hasn't happened yet for any of my colleagues.

macOS 14.7
Xcode 16.0

The process is killed because of an invalid code signature.

This is the only go binary where I've observed this problem.

go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

/Users/moody/go/1.22.5/bin/golangci-lint --version
zsh: killed     /Users/moody/go/1.22.5/bin/golangci-lint --version

codesign -vvvv /Users/moody/go/1.22.5/bin/golangci-lint
/Users/moody/go/1.22.5/bin/golangci-lint: invalid signature (code or signature have been modified)
In architecture: arm64

sample crash report

Like the original poster, resigning worked for me.

codesign --force --deep --sign - _tools/bin/golangci-lin

@ldez
Copy link
Member

ldez commented Oct 9, 2024

Based on issues on Go: https://github.com/golang/go/issues?q=is%3Aissue+%22Code+Signature+Invalid%22+is%3Aclosed

The problem seems to be related to tooling inside MacOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: macos Issue that is related to MacOS question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants