Problems with Importing dependencies from Remote

I’m trying out some Go examples and I started with a JSON parser and I wanted to add a dependency to a remote repository. I was under the assumption that the Go build process will pull the dependencies when I compile, but strangely it did not. Here is the error that I get!

main.go:8:9: cannot find package "" in any of:
	/usr/local/Cellar/go/1.9.1/libexec/src/ (from $GOROOT)
	/Users/joe/Projects/Private/go-projects/src/ (from $GOPATH)

Here is my import:

import (

Any ideas as to what is wrong happening here? I have my GOPATH and GOROOT set up properly!

did you download it before?

go get

I thought the Go build will resolve this for me. Won’t it do that? If I have 10 or even 100’s of those dependencies from remote, should I do a go get for each one of them? This is purely inefficient. I’m sure I’m doing something wrong or? Is there a way that Go downloads it automatically when doing a Go build?

At the time of compiling Go will not resolve its dependencies, you can use a dependency manager, such as “glide” : “” or “Go dep” : “” or any other

I like the glide, example:


package: main
- package:
  version: ^1.0.0
- package:
  - bson
- package:
- package:

and execute glide install

You can also go get yourpackage it will then get dependencies recursively

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.