在Google Go上进行项目,导入图书馆

everyone.

I am new to Go language and currently I am trying to understand the basics of building Go applications. I met the following problem.

For example, I am using other libraries in my project. I have them locally, on my computer, so my project works fine.

I am loading my code on github and another programmer download it. As I understand, my code won't work, because this programmer doesn't have the libraries I used.

So the question is: What is the best way to share my project with all libraries it has? Should I upload these libraries in the separate repositories? Then to use my project, people need to look inside the code to detect which libraries I am using to download them one by one?

For example, in Java there is such thing like Maven or Ant, which downloads all required dependencies. Is there any tools like this for Go?

Let's call the main file of my project main.go And I am using my own library: mathutil.go

what is the best way to make this project run on other computers?

Go's dependencies work very much like using Maven or IVY transitive dependencies. When someone does "go get" of your package, anything you depend on will automatically download.

For example, in your source:

import "github.com/foo/bar"

go will automatically download that to your $GOPATH/src/github.com/foo/bar along with your code.

Assuming the third party libs you use are hosted in a public repo (ie: github) then people don't need to do anything.

If the libraries you used are not available on a public repo, you will need to post them somewhere assuming their licensing allows.

Take a look at golang.org/doc/code.html for more details