v9
how should I fix the error as in the title.
the app container logs below:
hoge-api | ../gopkg.in/go-playground/validator.v9/translations/ja/ja.go:13:2: cannot find package "github.com/go-playground/validator/v10" in any of:
hoge-api | /usr/local/go/src/github.com/go-playground/validator/v10 (from $GOROOT)
hoge-api | /go/src/github.com/go-playground/validator/v10 (from $GOPATH)
when I attach the container and check the import sentences, it, indeed, imports "github.com/go-playground/validator/v10"
docker exec -it hoge-api head -n 20 /go/src/gopkg.in/go-playground/validator.v9/translations/ja/ja.go
package ja
import (
"fmt"
"log"
"reflect"
"strconv"
"strings"
"time"
"github.com/go-playground/locales"
ut "github.com/go-playground/universal-translator"
"github.com/go-playground/validator/v10" // **here**
// RegisterDefaultTranslations registers a set of default translations
// for all built in tag's in validator; you may add your own as desired.
func RegisterDefaultTranslations(v *validator.Validate, trans ut.Translator) (err error) {
translations := []struct {
the run command I use in Dockerfile is below.
RUN go get -u gopkg.in/go-playground/validator.v9
hello. i have error in v10 vendor/utils/validator.go:27:52: cannot use Validate (type *"gopkg.in/go-playground/validator.v10".Validate) as type *"github.com/go-playground/validator".Validate in argument to "gopkg.in/go-playground/validator.v10/translations/en".RegisterDefaultTranslations
see #549 , think it's fixed on v9.30.2
@deankarn
thank you so much. i'll try the new ver.
Please let me know if it鈥檚 all good now :)
still failing for me when validator is depended by gin
$ go get github.com/go-playground/validator/v10
package github.com/go-playground/validator/v10: cannot find package "github.com/go-playground/validator/v10" in any of:
/usr/local/Cellar/go/1.13.3/libexec/src/github.com/go-playground/validator/v10 (from $GOROOT)
/Users/lethe/work/go/src/github.com/go-playground/validator/v10 (from $GOPATH)
still failing for me when validator is depended by gin
$ go get github.com/go-playground/validator/v10 package github.com/go-playground/validator/v10: cannot find package "github.com/go-playground/validator/v10" in any of: /usr/local/Cellar/go/1.13.3/libexec/src/github.com/go-playground/validator/v10 (from $GOROOT) /Users/lethe/work/go/src/github.com/go-playground/validator/v10 (from $GOPATH)i got the same error
MacBook-Pro-3:go-playground zhuchuanyun$ go get github.com/go-playground/validator/v10
package github.com/go-playground/validator/v10: cannot find package "github.com/go-playground/validator/v10" in any of:
/Volumes/NVME/usr/go/src/github.com/go-playground/validator/v10 (from $GOROOT)
/Volumes/NVME/usr/golang/src/github.com/go-playground/validator/v10 (from $GOPATH)
Any updates on this? This is a blocker because the docker builds are failing for us. Please help
Any updates on this? This is a blocker because the docker builds are failing for us. Please help
I
still failing for me when validator is depended by gin
$ go get github.com/go-playground/validator/v10 package github.com/go-playground/validator/v10: cannot find package "github.com/go-playground/validator/v10" in any of: /usr/local/Cellar/go/1.13.3/libexec/src/github.com/go-playground/validator/v10 (from $GOROOT) /Users/lethe/work/go/src/github.com/go-playground/validator/v10 (from $GOPATH)i got the same error
MacBook-Pro-3:go-playground zhuchuanyun$ go get github.com/go-playground/validator/v10
package github.com/go-playground/validator/v10: cannot find package "github.com/go-playground/validator/v10" in any of:
/Volumes/NVME/usr/go/src/github.com/go-playground/validator/v10 (from $GOROOT)
/Volumes/NVME/usr/golang/src/github.com/go-playground/validator/v10 (from $GOPATH)
There's something wrong with this library , if you "go get" or "govendor fetch" the latest version, there is still not a folder named "v10" or it is empty, so you have to do it manually:
$go get "gopkg.in/go-playground/validator.v10"
$mkdir -p $GOPATH/src/vendor/github.com/go-playground/validator/v10
$cp -rf $GOPATH/src/gopkg.in/go-playground/validator.v10/* $GOPATH/src/vendor/github.com/go-playground/validator/v10
@laoluotuo are you using go modules?
I ask because you mentioned using govendor.
The path with the v10 suffix won鈥檛 work with pre-existing tooling prior to go modules, but you should be able to drop the suffix if that鈥檚 the case.
@laoluotuo are you using go modules?
I ask because you mentioned using govendor.The path with the v10 suffix won鈥檛 work with pre-existing tooling prior to go modules, but you should be able to drop the suffix if that鈥檚 the case.
I'm only using govendor
Try these.
It worked in my case.
$ sudo add-apt-repository ppa:longsleep/golang-backports
$ sudo apt-get update
$ sudo apt-get install golang-go
still getting same error
Hey all, I've had to explain this a few times, go modules has fractured the community pretty hard.
gopkg.in/go-playground/validator.v10 is NOT a valid import path鉂楋笍
v10 was the changeover from using gopkg.in to go modules for versioning. If you are not on go modules, stick with gopkg.in/go-playground/validator.v9, if you're using go modules, update to using github.com/go-playground/validator/v10.
I encourage everyone to update to using Go Modules to help resolve the bad state the community is in where much of the old versioning tooling is not compatible with the new Go Modules.
Most helpful comment
I
There's something wrong with this library , if you "go get" or "govendor fetch" the latest version, there is still not a folder named "v10" or it is empty, so you have to do it manually:
$go get "gopkg.in/go-playground/validator.v10"
$mkdir -p $GOPATH/src/vendor/github.com/go-playground/validator/v10
$cp -rf $GOPATH/src/gopkg.in/go-playground/validator.v10/* $GOPATH/src/vendor/github.com/go-playground/validator/v10