Errors thrown by `golangci-lint` for validator package
- [X] I have looked at the documentation here first?
- [X] I have looked at the examples provided that may showcase my question here?
Package version eg. v9, v10:
v9.31.0
Issue, Question or Enhancement:
When using the golangci-lint watcher provided by GoLand:
Every time a file is saved, I get errors from the validator package:
mypath/my_file.go:245:14: undeclared name: `validator` (typecheck)
validate := validator.New()
and also:
mypath/my_file.go:16:2: "gopkg.in/go-playground/validator.v9" imported but not used (typecheck)
"gopkg.in/go-playground/validator.v9"
For each one of the files I am using the package:

I can see it runs the following command:
golangci-lint run --disable=typecheck
Code sample, to showcase or reproduce:
https://goplay.tools/snippet/b--sydpv40H
package main
import (
"github.com/gofrs/uuid"
"gopkg.in/go-playground/validator.v9"
)
type MyRequest struct {
UserID uuid.UUID `json:"user_id" validate:"required"`
}
func main() {
request := &MyRequest{UserID: uuid.Must(uuid.NewV4())}
validate := validator.New()
err := validate.Struct(request)
if err != nil {
panic(err)
}
}
Save file, then run:
golangci-lint run --disable=typecheck yourfile.go
Are you sure your import path is correct ?
Instead of "gopkg.in/go-playground/validator.v9", "github.com/go-playground/validator/v10" is the path used in the examples and it is also the one referenced on https://pkg.go.dev/github.com/go-playground/validator/v10
Hi, I believe this was the older recommended way of importing the package. Since v10, I know they have github.com/go-playground/validator/v10 on the docs. I also tried with this import, and get the same result
have you tried to run your code ? Because it looks like the validator package was simply not downloaded and thus golangci-lint is unable to find a declaration for the validator object and throws the error/warning
Yes, the code runs fine, but just when the watcher runs intermittently I get this error. It behaves functionally fine, as in it builds and runs, but this output just gets returned during the watcher run