Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Prebuilt binaries supporting plugins / custom linters#3361

Closed Answeredbyldez
ian-h-chamberlain asked this question inIdeas
Discussion options

There has been some previous discussion about this in some other issues:

Since some of those weren't totally relevant to the attached issues and/or closed, I thought it might make sense to start a new discussion about ways that it might be possible to use prebuiltgolangci-lint binaries with plugin support.

As I understand it, there are a few requirements needed to support Go plugins (copy-pasting from#3259 (reply in thread) for reference):

  • exact same Go version
  • same OS/arch
  • same version of shared dependencies
  • CGO_ENABLED=1 during build

I believe (although not 100% positive) that for the first three of these, the Go runtime verifies these and refuses to load a plugin if these conditions are not met.

I am also under the impression thatCGO_ENABLED=0 is used when building releases to improve portability for the distributed binaries. Although it's not clear to me exactly how, I can understand that there might be two use cases here:

  • more portable + no plugins
  • less portable + plugins

With that in mind, does it seem like a reasonable option to publish two versions of the binaries, one with plugin support (CGO_ENABLED=1) and one without? Existing users could continue to use the same binaries they already use without any change, but custom plugin support (within the constraints listed above) would be possible without requiring a build from source.


Barring any functional changes like publishing plugin-compatible binaries, I think there might be two things that would help users understand what's going on with the status quo:

You must be logged in to vote
Answered by ldezNov 15, 2022

Hello,
it's not possible to pre-build something compatible with plugins because the plugin and the binary must be built with the same Go stack/environment.
CGO_ENABLED is only one of the requirements.

Replies: 1 comment 3 replies

Comment options

ldez
Nov 15, 2022
Maintainer

Hello,
it's not possible to pre-build something compatible with plugins because the plugin and the binary must be built with the same Go stack/environment.
CGO_ENABLED is only one of the requirements.

You must be logged in to vote
3 replies
@stevenh
Comment options

Should we endeavour to update the docs and improve the error when this is the case so its clear to the user?

@ian-h-chamberlain
Comment options

because the plugin and the binary must be built with the same Go stack/environment.

That means it should still be possible to write a plugin against a specificgolangci-lint version, right? As long as thatgolangci-lint binary was built withCGO_ENABLED=1?

It seems to me the advantage of having plugin support at all is somewhat diminished if you have to build the binary from scratch anyway — at that point, why not just add your custom lint directly into the binary instead?

@philiplinell
Comment options

FYI, this is now added to the documentation#3468.

Answer selected byldez
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
4 participants
@ian-h-chamberlain@stevenh@philiplinell@ldez

[8]ページ先頭

©2009-2025 Movatter.jp