Skip to content

Latest commit

 

History

History
124 lines (98 loc) · 3.13 KB

File metadata and controls

124 lines (98 loc) · 3.13 KB

Building your app

Gopkg.toml

Golang has a few dependency management tools. In this tutorial you will be using dep. dep uses a Gopkg.toml file in the root of the repository to define what dependencies the application needs. CosmosSDK apps currently depend on specific versions of some libraries. The below manifest contains all the necessary versions

# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
#   name = "github.com/user/project"
#   version = "1.0.0"
#
# [[override]]
#   name = "github.com/x/y"
#   version = "2.4.0"
#
# [prune]
#   non-go = false
#   go-tests = true
#   unused-packages = true

[[constraint]]
  name = "github.com/cosmos/cosmos-sdk"
  branch = "develop"

[[override]]
  name = "github.com/golang/protobuf"
  version = "=1.1.0"

[[constraint]]
  name = "github.com/spf13/cobra"
  version = "~0.0.1"

[[constraint]]
  name = "github.com/spf13/viper"
  version = "~1.0.0"

[[override]]
  name = "github.com/tendermint/go-amino"
  version = "=v0.12.0"

[[override]]
  name = "github.com/tendermint/iavl"
  version = "=v0.11.0"

[[override]]
  name = "github.com/tendermint/tendermint"
  version = "=0.25.0"

[[override]]
  name = "golang.org/x/crypto"
  source = "https://github.com/tendermint/crypto"
  revision = "3764759f34a542a3aef74d6b02e35be7ab893bba"

[prune]
  go-tests = true
  unused-packages = true

Makefile

Let us finish our application by writing the makefile.

get_tools:
ifdef DEP_CHECK
    @echo "Dep is already installed.  Run 'make update_tools' to update."
else
    @echo "Installing dep"
    go get -v $(DEP)
endif
ifdef STATIK_CHECK
    @echo "Statik is already installed.  Run 'make update_tools' to update."
else
    @echo "Installing statik"
    go version
    go get -v $(STATIK)
endif

get_vendor_deps:
    @echo "--> Generating vendor directory via dep ensure"
    @rm -rf .vendor-new
    @dep ensure -v -vendor-only

update_vendor_deps:
  @echo "--> Running dep ensure"
  @rm -rf .vendor-new
  @dep ensure -v -update

install:
    go install ./cmd/nameshaked
    go install ./cmd/nameshakecli

Building the app

First, you need to install dep. Below there is a command for using a shell script from dep's site to preform this install.

NOTE: If you are uncomfortable |ing curl output to sh (you should be) then check out your platform specific installation instructions.

# Install dep
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

# Initialize dep and install dependencies
dep init
dep ensure -v -upgrade

# Install the app into your $GOBIN
make install

# Now you should be able to run the following commands:
nameserviced help
nameservicecli help

Congratulations, you have finished your nameservice application! You can now run it and interract with it