go - non-standard import in standard package windows -
i can't seem run go code because of error
non-standard import "gopkg.in/olivere/elastic.v5" in standard package "goprojects/search"
main.go located at: c:\go\src\goprojects\search\main.go
goroot c:\go
gopath c:\go\src\goprojects (tried adding current working directory here \search, didnt help)
when run "go gopkg.in/olivere/elastic.v5" imported files in c:\go\src\goprojects\src\gopkg.in\olivere\elastic.v5
visual studio code giving me message
cannot find package "go.pkg.in/olivere/elastic.v5" in of:
c:\go\src\vendor\gopkg.in\olivere\elastic.v5 (vendor tree)
c:\go\src\gopkg.in\olivere\elastic.v5 (from $goroot)
c:\go\src\goprojects\src\gopkg.in\olivere\elastic.v5 (from $gopath)
my code
package main import ( "fmt" "net/http" elastic "gopkg.in/olivere/elastic.v5" ) func main() { http.handlefunc("/search", search) http.listenandserve(":3000", nil) } func search(w http.responsewriter, r *http.request) { searchstring := r.url.query().get("q") fmt.println("searching for" + searchstring) // create client client, err := elastic.newclient() w.write([]byte(searchstring)) }
moved goprojects out of goroot path , separate folder in c:\goprojects , replaced gopath new path , worked.
Comments
Post a Comment