I have Go installed on my system and can install packages that conform to the go get ...
pattern. As you can see in this link, MIT is using Go for one of its courses. However, installing the provided code isn't as easy as running go get ...
and having all the packages installed in the proper place. Rather, it asks you to clone the repository and then "Compile the initial software we provide you and run it with the downloaded input file". As you can also see, it instructs the user to export a GOPATH (I think assuming that the students are using Go for the first time)
git clone git://g.csail.mit.edu/6.824-golabs-2014 6.824
$ add 6.824
$ export GOPATH=$HOME/6.824
$ cd ~/6.824/src/main
$ go run wc.go master kjv12.txt sequential
When I clone the repo and run go run wc.go master kjv12.txt sequential
from /src/main
it can't find the packages. The source code (for example, the wc.go
file that was supposed to be run), seems to assume the packages are in the same directory. This is the wc.go file that's in /src/main
and which needs /src/mapreduce
import "os"
import "fmt"
import "mapreduce"
import "container/list"
What's the best/easiest/most convenient way to compile code that's distributed like this? One way I can think of is to cd
into each package, run go install
and then change the import path in each file that requires these packages, which is very time consuming and I'm assuming is not the recommended way, and I also don't want to change the GOPATH