docs: Fix installation instructions for golangci-lint v2 compatibility#175
docs: Fix installation instructions for golangci-lint v2 compatibility#175JoelSpeed merged 2 commits intokubernetes-sigs:mainfrom
Conversation
|
I've tested the standalone binary build with |
.custom-gcl.yml
Outdated
| - module: 'sigs.k8s.io/kube-api-linter' | ||
| path: ./ | ||
| - module: 'sigs.k8s.io/kube-api-linter' | ||
| version: 'v0.0.0-20251029172002-9992248f8813' |
There was a problem hiding this comment.
Probably still want this to point to the local path, this isn't an example necessarily but a way to build what's in the repo locally
Makefile
Outdated
| .PHONY: build | ||
| build: ## Build the golangci-lint custom plugin binary. | ||
| go build -o ./bin ./cmd/golangci-lint-kube-api-linter | ||
| go build -o ./bin/golangci-lint-kube-api-linter ./cmd/golangci-lint-kube-api-linter |
There was a problem hiding this comment.
Does this actually make a difference? On my machine the before and after appear to produce the same results
There was a problem hiding this comment.
the build works the same for me. Reverted 👍🏻
README.md
Outdated
|
|
||
| ```shell | ||
| golangci-kube-api-linter run path/to/api/types --fix | ||
| ./bin/golangci-lint-kube-api-linter run path/to/api/types --fix |
There was a problem hiding this comment.
I guess generally we expect people to sort their own path, maybe we don't need to prefix the bin here?
README.md
Outdated
|
|
||
| [golangci-lint-plugin-docs]: https://golangci-lint.run/plugins/go-plugins/ | ||
|
|
||
| **Important**: The plugin must be built from the vendor directory, not directly from the module path. |
There was a problem hiding this comment.
Is this true? Many projects don't use vendor, I expect they can still use the plugin no?
There was a problem hiding this comment.
right just tested that locally, making vendor optional 👍🏻
| **Step 2**: Build the plugin from the vendor directory: | ||
|
|
||
| ```shell | ||
| go build -buildmode=plugin -o bin/kube-api-linter.so sigs.k8s.io/kube-api-linter/pkg/plugin |
There was a problem hiding this comment.
Losing pkg/plugin here is not correct. The root module is for module mode, the plugin path is for the plugin mode, they are different codepaths to build
00be6aa to
930e1c8
Compare
README.md
Outdated
| To get the correct pseudo-version for the latest commit, run: | ||
|
|
||
| ```bash | ||
| TZ=UTC git --no-pager show --quiet --abbrev=12 --date='format-local:%Y%m%d%H%M%S' --format="%cd-%h" | ||
| ``` |
There was a problem hiding this comment.
This is assuming they have a local version of kube-api-linter checked out right?
https://pkg.go.dev/sigs.k8s.io/kube-api-linter?tab=versions is probably a good source of truth for the latest version string
There was a problem hiding this comment.
yeah that's right.
maybe suggesting to check the latest version as a better source of truth would be a better idea?
| To get the correct pseudo-version for the latest commit, run: | |
| ```bash | |
| TZ=UTC git --no-pager show --quiet --abbrev=12 --date='format-local:%Y%m%d%H%M%S' --format="%cd-%h" | |
| ``` | |
| To find the latest version listed, check [pkg.go.dev/sigs.k8s.io/kube-api-linter?tab=versions](https://pkg.go.dev/sigs.k8s.io/kube-api-linter?tab=versions) | |
README.md
Outdated
|
|
||
| ```yaml | ||
| version: "2" | ||
|
|
There was a problem hiding this comment.
Any reason for this additional whitespace?
README.md
Outdated
|
|
||
| The output binary will be a combination of the initial `golangci-lint` binary and the Kube API linter plugin. | ||
| This means that you can use any of the standard `golangci-lint` configuration or flags to run the binary, but may also include the Kube API Linter rules. | ||
| The output binary `./bin/golangci-lint-kube-api-linter` will be a combination of the `golangci-lint` binary with the Kube API Linter included as a module. |
There was a problem hiding this comment.
will it always be ./bin/... as the pathing from golangci-lint custom?
README.md
Outdated
| go build -buildmode=plugin -o $(OUTPUT_DIR)/kube-api-linter.so sigs.k8s.io/kube-api-linter/pkg/plugin | ||
| ``` | ||
|
|
||
| Example - building into a `bin` directory: |
There was a problem hiding this comment.
do we need an explicit example of building into a specific directory?
There was a problem hiding this comment.
yep, a single example should suffice too 👍🏻
c1ad844 to
e9aa474
Compare
|
/label tide/merge-method-squash |
e9aa474 to
9ad19ec
Compare
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: everettraven, JoelSpeed, krishagarwal278 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@JoelSpeed I've updated the README to fix the installation issues.
Main changes:
version: "2"to all the.golangci.ymlexamplesFixes #145