Skip to content

Commit bf6c68a

Browse files
kayhawwkozaczuk
authored andcommitted
Capstan:Migrate to Go Modules and Update APIs (#183)
As a Go project, Capstan uses godep as its dependency manager, however, as of Go 1.11, Go's new dependency management system(Go Modules) is introduced officially, more and more Go projects use Go Modules to make dependency version information explicit and easier to manage, this patch makes Capstan migrate to Go Modules and update codes to use the latest APIs, here are details: - Delete Godeps directory, add go.mod and go.sum file, which are generated by `go mod` command and declare Capstan project is managed with Go Modules now - Update packages import path, change urfave/cli from v1 to v2, change cheggaaa/pb from v0 to v3, all packages are newest released version - Update code to adapt new APIs according to the old/new API doc - Update the installation.md, use Go 1.11+ to build/manage Capstan on Module Mode See [Go Modules Blogs](https://blog.golang.org/using-go-modules) to learn more Signed-off-by: kayhaw <[email protected]>
1 parent d9a51ec commit bf6c68a

13 files changed

+234
-194
lines changed

Documentation/Installation.md

+17-8
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ There you go, happy unikernel creating!
4646

4747
## Install Capstan from source (advanced)
4848

49-
### Install Go 1.7+
49+
### Install Go 1.11+
5050
Capstan is a Go project and needs to be compiled first. But heads up, compiling Go project is trivial,
5151
as long as you have Go installed. Consult [official documentation](https://golang.org/doc/install)
5252
to learn how to install Go, or use this bash snippet to do it for you:
5353
```bash
54-
curl https://storage.googleapis.com/golang/go1.12.6.linux-amd64.tar.gz | sudo tar xz -C /usr/local
55-
sudo mv /usr/local/go /usr/local/go1.12
56-
sudo ln -s /usr/local/go1.12 /usr/local/go
54+
curl https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz | sudo tar xz -C /usr/local
55+
sudo mv /usr/local/go /usr/local/go1.13
56+
sudo ln -s /usr/local/go1.13 /usr/local/go
5757

5858
export GOPATH=$HOME/go
5959
export PATH=$GOPATH/bin:$PATH
@@ -63,15 +63,24 @@ export PATH=/usr/local/go/bin:$PATH
6363
### Compile Capstan
6464
Since Capstan is hosted on GitHub, the compilation process is as simple as:
6565
```
66-
go get github.com/cloudius-systems/capstan
67-
go install github.com/cloudius-systems/capstan
66+
git clone [email protected]:cloudius-systems/capstan.git
67+
cd capstan
68+
export GO111MODULE=on # Needed for Go 1.11, 1.12
69+
go install
6870
```
69-
That's it, we have Capstan installed. You should be able to use Capstan immediately because it was
70-
installed in `$GOPATH/bin` added to your `$PATH` above. To test that it works, try:
71+
That's it, we have Capstan installed. You should be able to use Capstan immediately because it was installed in `$GOPATH/bin` added to your `$PATH` above. To test that it works, try:
7172
```
7273
capstan --help
7374
```
7475

76+
## Maintain Capstan
77+
Capstan is managed with Go Modules as [recommended](https://blog.golang.org/using-go-modules), while developing on Capstan, you should follow these steps:
78+
1. Update import path and corresponding code as you might do
79+
2. Test you changes with `go test ./...`
80+
3. Clear up `go.mod` and `go.sum` file with `go mod tidy`
81+
82+
Then you are ready to tag and release new version. To learn more details about maintaining Go project on Module Mode, see [Go Modules Serial Blogs](https://blog.golang.org/using-go-modules)
83+
7584
## Configure Capstan (advanced)
7685
Capstan uses optimized default values under the hood. But you are allowed to override them with
7786
your own values and this section describes how. Actually, there are three ways to override them

Godeps/Godeps.json

-38
This file was deleted.

Godeps/Readme

-5
This file was deleted.

0 commit comments

Comments
 (0)