Skip to content

When building a custom linter, the resulting custom-gcl cannot find canonicalheader #5340

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
6 of 7 tasks
gmlewis opened this issue Jan 21, 2025 · 4 comments
Closed
6 of 7 tasks
Labels
question Further information is requested

Comments

@gmlewis
Copy link

gmlewis commented Jan 21, 2025

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

Using this PR: google/go-github#3447
I create a custom linter locally by running:

$ go version
go version go1.23.5 darwin/arm64

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

$ golangci-lint --version
golangci-lint has version v1.63.4 built with go1.23.5 from (unknown, modified: ?, mod sum: "h1:bJQFQ3hSfUto597dkL7ipDzOxsGEpiWdLiZ359OWOBI=") on (unknown)

$ golangci-lint -v custom
INFO Cloning golangci-lint repository
INFO Adding plugin imports
INFO generated imports info /var/folders/yx/06mn6xqd12d98bcbspd4h69w0000gn/T/custom-gcl3726798118/golangci-lint/cmd/golangci-lint/plugins.go:
package main

import (
        _ "github.com/google/go-github/v68/tools/sliceofpointers"
)

INFO Adding replace directives
INFO run: go mod edit -replace github.com/google/go-github/v68/tools/sliceofpointers=/Users/glenn/go/src/github.com/google/go-github/tools/sliceofpointers
INFO Running go mod tidy
INFO Building golangci-lint binary
INFO Moving golangci-lint binary

$ ls -l custom-gcl && file custom-gcl
-rwxr-xr-x@ 1 glenn  staff  32275474 Jan 21 14:58 custom-gcl
custom-gcl: Mach-O 64-bit executable arm64

$ ./custom-gcl -v linters
INFO [config_reader] Config search paths: [./ /Users/glenn/go/src/github.com/google/go-github /Users/glenn/go/src/github.com/google /Users/glenn/go/src/github.com /Users/glenn/go/src /Users/glenn/go /Users/glenn /Users /]
INFO [config_reader] Used config file .golangci.yml
WARN [config_reader] The configuration option `run.skip-dirs-use-default` is deprecated, please use `issues.exclude-dirs-use-default`.
INFO Loaded : sliceofpointers
Error: unknown linters: 'canonicalheader', run 'golangci-lint help linters' to see the list of supported linters
Failed executing command with error: unknown linters: 'canonicalheader', run 'golangci-lint help linters' to see the list of supported linters

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.63.4 built with go1.23.5 from (unknown, modified: ?, mod sum: "h1:bJQFQ3hSfUto597dkL7ipDzOxsGEpiWdLiZ359OWOBI=") on (unknown)

Configuration

n/a

Go environment

$ go version && go env
go version go1.23.5 darwin/arm64

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO golangci-lint has version v1.63.4 built with go1.23.5 from (unknown, modified: ?, mod sum: "h1:bJQFQ3hSfUto597dkL7ipDzOxsGEpiWdLiZ359OWOBI=") on (unknown)
INFO [config_reader] Config search paths: [./ /Users/glenn/go/src/github.com/google/go-github /Users/glenn/go/src/github.com/google /Users/glenn/go/src/github.com /Users/glenn/go/src /Users/glenn/go /Users/glenn /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO Loaded : sliceofpointers
Error: build linters: plugin(sliceofpointers): plugin "sliceofpointers" not found
Failed executing command with error: build linters: plugin(sliceofpointers): plugin "sliceofpointers" not found

A minimal reproducible example or link to a public repository

google/go-github#3447

Validation

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

Supporter

@gmlewis gmlewis added the bug Something isn't working label Jan 21, 2025
Copy link

boring-cyborg bot commented Jan 21, 2025

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

@ccoVeille
Copy link
Contributor

ccoVeille commented Jan 21, 2025

Try the following command

custom-gcl version

or add a -v to your call to custom-gcl run

You might find out the custom-gcl uses an older version.

There is the version of golangci-lint in the .custom-gcl.yaml file you have

I got the problem once

@ldez ldez added question Further information is requested and removed bug Something isn't working labels Jan 21, 2025
@ldez ldez self-assigned this Jan 21, 2025
@ldez
Copy link
Member

ldez commented Jan 21, 2025

This is because you define golangci-lint v1.57 as a base for your custom build.

https://github.com/gmlewis/go-github/blob/7fa7c02119d95db734e3497e77db461f38b8d7c7/.custom-gcl.yml#L1

canonicalheader has been added in v1.58: https://golangci-lint.run/usage/linters/#canonicalheader

@ldez ldez closed this as completed Jan 21, 2025
@gmlewis
Copy link
Author

gmlewis commented Jan 21, 2025

This is because you define golangci-lint v1.57 as a base for your custom build.

Thank you, @ldez !

I apologize for the noise.

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

No branches or pull requests

3 participants