I can't seem to run my go code because of this error
non-standard import "gopkg.in/olivere/elastic.v5" in standard package "goprojects/search"
Main.go is located at: C:\Go\src\goprojects\search\main.go
GOROOT is C:\Go
GOPATH is C:\Go\src\goprojects (tried adding my current working directory here \search, but didnt help)
when I run "go get gopkg.in/olivere/elastic.v5" I get the imported files in C:\Go\src\goprojects\src\gopkg.in\olivere\elastic.v5
visual studio code is giving me this message
cannot find package "go.pkg.in/olivere/elastic.v5" in any 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 a client
client, err := elastic.NewClient()
w.Write([]byte(searchString))
}