go-ozzo / ozzo-validation

An idiomatic Go (golang) validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags.
MIT License
3.73k stars 224 forks source link

cannot find package "github.com/go-ozzo/ozzo-validation/v4" #120

Closed khanakia closed 4 years ago

khanakia commented 4 years ago

Hi,

I am trying to install the package and getting error when i run the following command go get github.com/go-ozzo/ozzo-validation/v4

ERROR

Lucians-MacBook-Pro:jeoga_go khanakia$ go get github.com/go-ozzo/ozzo-validation/v4
package github.com/go-ozzo/ozzo-validation/v4: cannot find package "github.com/go-ozzo/ozzo-validation/v4" in any of:
    /usr/local/Cellar/go/1.14.2_1/libexec/src/github.com/go-ozzo/ozzo-validation/v4 (from $GOROOT)
    /Volumes/D/www/go/src/github.com/go-ozzo/ozzo-validation/v4 (from $GOPATH)
    /Volumes/D/www/go/src/github.com/khanakia/go_code/jeoga_go/src/github.com/go-ozzo/ozzo-validation/v4
Lucians-MacBook-Pro:jeoga_go khanakia$ 
qiangxue commented 4 years ago

Thanks for reporting the issue! I have fixed the README. go get github.com/go-ozzo/ozzo-validation should be fine.

khanakia commented 4 years ago

@qiangxue There is one more issue when installing the go get github.com/go-ozzo/ozzo-validation It is not installing the pkg dependecy github.com/asaskevich/govalidator because of which validation giving error. So how to auto install the pkg depedency ?

qiangxue commented 4 years ago

Actually the instruction on using go get to install packages is a bit outdated. If you use go mod, it will help you automatically install all needed dependencies.

khanakia commented 4 years ago

@qiangxue I do not understand can you point me the exact commands please it will be helpful. Thanks

qiangxue commented 4 years ago

https://blog.golang.org/using-go-modules

khanakia commented 4 years ago

I have checked that article already. I am not talking about building modules. I am talking about ozzo-validation which requires govalidator as dependency. So when i do go get github.com/go-ozzo/ozzo-validation it does not installs the govalidator automatically.

qiangxue commented 4 years ago

If you are using go modules, then you don't need to explicitly "go get" the dependent modules as they will be automatically retrieved when you build your project.

khanakia commented 4 years ago

But what about using the ozzo-validation in normal project where i do not have modules. So will i have to install the govalidator manually always ? github.com/asaskevich/govalidator

qiangxue commented 4 years ago

I was talking about normal projects that have dependent modules such as ozzo-validation. If you use "go mod" to manage the dependent modules, you don't need to manually install the dependent modules.

khanakia commented 4 years ago

I am getting an error while using go mod command please check the below error

Lucians-MacBook-Pro:jeoga_go khanakia$ go mod download github.com/go-ozzo/ozzo-validation
module github.com/go-ozzo/ozzo-validation: not a known dependency
qiangxue commented 4 years ago

That's not a right way of using go mod. Please check the blog article above in detail.

khanakia commented 4 years ago

I understand I will read the article in more detail. Thanks :)