2
votes

When I am trying to build my Go project in Windows by using

go build

, its giving an error,

api.go:7:2: cannot find package "gopkg.in/validator.v2" in any of:

C:\Go\src\gopkg.in\validator.v2 (from $GOROOT)

C:\Home\GO..\src\gopkg.in\validator.v2 (from $GOPATH)

How to add this package to my project?

When I tried to add the above package by,

go get gopkg.in\validator.v2

then its giving another error like,

go: missing Git command. See https://golang.org/s/gogetcmd package gopkg.in/validator.v2: exec: "git": executable file not found in %PATH%

1
By doing go get.Volker
@Volker : Its giving another error, go: missing Git command. See golang.org/s/gogetcmd package gopkg.in/validator.v2: exec: "git": executable file not found in %PATH%itzmebibin
Install git and append the executable directory to your PATH so you can use it from cmd prompt.photoionized

1 Answers

2
votes

go get uses git or hg to fetch a package, so you have to install it. For windows you can use this link.