Skip to content

Commit

Permalink
Capstan:Migrate to Go Modules and Update APIs (#183)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kayhaw authored and wkozaczuk committed Dec 15, 2019
1 parent d9a51ec commit bf6c68a
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 194 deletions.
25 changes: 17 additions & 8 deletions Documentation/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ There you go, happy unikernel creating!

## Install Capstan from source (advanced)

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

export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
Expand All @@ -63,15 +63,24 @@ export PATH=/usr/local/go/bin:$PATH
### Compile Capstan
Since Capstan is hosted on GitHub, the compilation process is as simple as:
```
go get github.com/cloudius-systems/capstan
go install github.com/cloudius-systems/capstan
git clone [email protected]:cloudius-systems/capstan.git
cd capstan
export GO111MODULE=on # Needed for Go 1.11, 1.12
go install
```
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:
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:
```
capstan --help
```

## Maintain Capstan
Capstan is managed with Go Modules as [recommended](https://blog.golang.org/using-go-modules), while developing on Capstan, you should follow these steps:
1. Update import path and corresponding code as you might do
2. Test you changes with `go test ./...`
3. Clear up `go.mod` and `go.sum` file with `go mod tidy`

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)

## Configure Capstan (advanced)
Capstan uses optimized default values under the hood. But you are allowed to override them with
your own values and this section describes how. Actually, there are three ways to override them
Expand Down
38 changes: 0 additions & 38 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

Loading

0 comments on commit bf6c68a

Please sign in to comment.