Convert project to glide.

Fixes #399.
This commit is contained in:
Josh Rickmar 2016-04-19 14:48:09 -04:00
parent a549b6908a
commit 91093362f2
7 changed files with 212 additions and 39 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
btcwallet
vendor

View file

@ -1,15 +1,17 @@
language: go
go:
- 1.5.3
- 1.6
- 1.5.4
- 1.6.1
sudo: false
before_install:
- gotools=golang.org/x/tools
install:
- go get -d -t -v ./...
- go get -v github.com/Masterminds/glide
- glide install
- go get -v $(glide novendor)
- go get -v $gotools/cmd/cover
- go get -v github.com/bradfitz/goimports
- go get -v github.com/golang/lint/golint
- go get -v github.com/davecgh/go-spew/spew
script:
- export PATH=$PATH:$HOME/gopath/bin
- ./goclean.sh

View file

@ -66,15 +66,72 @@ https://github.com/btcsuite/btcwallet/releases
### Windows/Linux/BSD/POSIX - Build from source
- If necessary, install Go according to the installation instructions
here: http://golang.org/doc/install. It is recommended to add
`$GOPATH/bin` to your `PATH` at this point.
Building or updating from source requires the following build dependencies:
- **Go 1.5 or 1.6**
Installation instructions can be found here: http://golang.org/doc/install.
It is recommended to add `$GOPATH/bin` to your `PATH` at this point.
- **Glide**
Glide is used to manage project dependencies and provide reproducible builds.
To install:
`go get -u github.com/Masterminds/glide`
Unfortunately, the use of `glide` prevents a handy tool such as `go get` from
automatically downloading, building, and installing the source in a single
command. Instead, the latest project and dependency sources must be first
obtained manually with `git` and `glide`, and then `go` is used to build and
install the project.
**Getting the source**:
For a first time installation, the project and dependency sources can be
obtained manually with `git` and `glide` (create directories as needed):
- Run the following commands to obtain and install btcd, btcwallet
and all dependencies:
```
go get -u -v github.com/btcsuite/btcd/...
go get -u -v github.com/btcsuite/btcwallet/...
git clone https://github.com/btcsuite/btcwallet $GOPATH/src/github.com/btcsuite/btcwallet
cd $GOPATH/src/github.com/btcsuite/btcwallet
glide install
```
To update an existing source tree, pull the latest changes and install the
matching dependencies:
```
cd $GOPATH/src/github.com/btcsuite/btcwallet
git pull
glide install
```
**Building/Installing**:
The `go` tool is used to build or install (to `GOPATH`) the project. Some
example build instructions are provided below (all must run from the `btcwallet`
project directory) in a `sh`-compatible shell on Unix, or PowerShell on Windows
(`$()` subshells are not supported by `cmd`).
To build and install `btcwallet` and all helper commands (in the `cmd`
directory) to `$GOPATH/bin/`, as well as installing all compiled non-vendored
packages to `$GOPATH/pkg/` (**use this if you are unsure which command to
run**):
```
go install $(glide novendor)
```
To build a `btcwallet` executable and install it to `$GOPATH/bin/`:
```
go install
```
To build a `btcwallet` executable and place it in the current directory:
```
go build
```
## Getting Started

View file

@ -7,12 +7,16 @@ environment:
GOPATH: c:\projects
GORACE: halt_on_error=1
install:
init:
- go version
- go get -v -t ./...
- go get -u github.com/Masterminds/glide
- go get -u github.com/davecgh/go-spew/spew
install:
- glide install
build_script:
- go build ./...
- ps: go get $(glide novendor)
test_script:
- go test -v -race ./...
- ps: go test -race $(glide novendor)

74
glide.lock generated Normal file
View file

@ -0,0 +1,74 @@
hash: 340dfe35ff5fb371aef999130fa60b2d7c84384c0c23bed06bbfd712139a6b3e
updated: 2016-04-19T15:13:03.285169879-04:00
imports:
- name: github.com/btcsuite/bolt
version: 38b9bbfde72d4b62b6a038a3adfca64c44da0133
- name: github.com/btcsuite/btcd
version: 474547b211c8f5566d094478318fcfd3c2c838d4
subpackages:
- blockchain
- btcec
- btcjson
- chaincfg
- txscript
- wire
- database
- name: github.com/btcsuite/btclog
version: f96df2375f37300305f329b8e5258764b4f19a7f
- name: github.com/btcsuite/btcrpcclient
version: 64922553b5c21f333438edaed6e0ba2b5a7760ee
- name: github.com/btcsuite/btcutil
version: bdf4400ecafb82f0c121ed5db1ae70639e7f4018
subpackages:
- hdkeychain
- base58
- name: github.com/btcsuite/fastsha256
version: 302ad4db268b46f9ebda3078f6f7397f96047735
- name: github.com/btcsuite/go-flags
version: 6c288d648c1cc1befcb90cb5511dcacf64ae8e61
- name: github.com/btcsuite/go-socks
version: cfe8b59e565c1a5bd4e2005d77cd9aa8b2e14524
subpackages:
- socks
- name: github.com/btcsuite/golangcrypto
version: 53f62d9b43e87a6c56975cf862af7edf33a8d0df
subpackages:
- nacl/secretbox
- ripemd160
- scrypt
- ssh/terminal
- poly1305
- salsa20/salsa
- pbkdf2
- name: github.com/btcsuite/seelog
version: 313961b101eb55f65ae0f03ddd4e322731763b6c
- name: github.com/btcsuite/websocket
version: 31079b6807923eb23992c421b114992b95131b55
- name: github.com/golang/protobuf
version: 2ebff28ac76fb19e2d25e5ddd4885708dfdd5611
subpackages:
- proto
- name: golang.org/x/net
version: fb93926129b8ec0056f2f458b1f519654814edf0
subpackages:
- context
- http2
- trace
- http2/hpack
- internal/timeseries
- name: golang.org/x/sys
version: f64b50fbea64174967a8882830d621a18ee1548e
subpackages:
- unix
- name: google.golang.org/grpc
version: dd828651e45229541896bc41cd9cf2f89ac7002a
subpackages:
- codes
- credentials
- grpclog
- internal
- metadata
- naming
- transport
- peer
devImports: []

37
glide.yaml Normal file
View file

@ -0,0 +1,37 @@
package: github.com/btcsuite/btcwallet
import:
- package: github.com/btcsuite/bolt
- package: github.com/btcsuite/btcd
subpackages:
- blockchain
- btcec
- btcjson
- chaincfg
- txscript
- wire
- package: github.com/btcsuite/btclog
- package: github.com/btcsuite/btcrpcclient
- package: github.com/btcsuite/btcutil
subpackages:
- hdkeychain
- package: github.com/btcsuite/fastsha256
- package: github.com/btcsuite/go-flags
- package: github.com/btcsuite/golangcrypto
subpackages:
- nacl/secretbox
- ripemd160
- scrypt
- ssh/terminal
- package: github.com/btcsuite/seelog
- package: github.com/btcsuite/websocket
- package: github.com/golang/protobuf
subpackages:
- proto
- package: golang.org/x/net
subpackages:
- context
- package: google.golang.org/grpc
subpackages:
- codes
- credentials
- grpclog

View file

@ -1,38 +1,36 @@
#!/bin/bash
# The script does automatic checking on a Go package and its sub-packages, including:
# 1. gofmt (http://golang.org/cmd/gofmt/)
# 2. goimports (https://github.com/bradfitz/goimports)
# 3. golint (https://github.com/golang/lint)
# 4. go vet (http://golang.org/cmd/vet)
# 5. race detector (http://blog.golang.org/race-detector)
# 6. test coverage (http://blog.golang.org/cover)
# 1. go fmt (http://golang.org/cmd/gofmt/)
# 2. golint (https://github.com/golang/lint)
# 3. go vet (http://golang.org/cmd/vet)
# 4. race detector (http://blog.golang.org/race-detector)
set -ex
# Automatic checks
test -z "$(gofmt -l -w . | tee /dev/stderr)"
test -z "$(goimports -l -w . | tee /dev/stderr)"
test -z "$(golint ./... | grep -v 'ALL_CAPS\|OP_\|NewFieldVal\|RpcCommand\|RpcRawCommand\|RpcSend\|Dns\|api.pb.go\|StartConsensusRpc\|factory_test.go\|legacy' | tee /dev/stderr)"
test -z "$(go vet ./... 2>&1 | grep -v 'Example\|newestSha\|rpcserver/server.go' | tee /dev/stderr)"
env GORACE="halt_on_error=1" go test -v -race ./...
test -z "$(go fmt $(glide novendor) | tee /dev/stderr)"
# test -z "$(goimports -l -w . | tee /dev/stderr)"
test -z "$(for package in $(glide novendor); do golint $package; done | grep -v 'ALL_CAPS\|OP_\|NewFieldVal\|RpcCommand\|RpcRawCommand\|RpcSend\|Dns\|api.pb.go\|StartConsensusRpc\|factory_test.go\|legacy' | tee /dev/stderr)"
test -z "$(go vet $(glide novendor) 2>&1 | grep -v '^exit status \|Example\|newestSha\| not a string in call to Errorf$' | tee /dev/stderr)"
env GORACE="halt_on_error=1" go test -v -race $(glide novendor)
# Run test coverage on each subdirectories and merge the coverage profile.
set +x
echo "mode: count" > profile.cov
#set +x
#echo "mode: count" > profile.cov
# Standard go tooling behavior is to ignore dirs with leading underscores.
for dir in $(find . -maxdepth 10 -not -path '.' -not -path './.git*' \
-not -path '*/_*' -not -path './cmd*' -not -path './release*' -type d)
do
if ls $dir/*.go &> /dev/null; then
go test -covermode=count -coverprofile=$dir/profile.tmp $dir
if [ -f $dir/profile.tmp ]; then
cat $dir/profile.tmp | tail -n +2 >> profile.cov
rm $dir/profile.tmp
fi
fi
done
#for dir in $(find . -maxdepth 10 -not -path '.' -not -path './.git*' \
# -not -path '*/_*' -not -path './cmd*' -not -path './release*' -type d)
#do
#if ls $dir/*.go &> /dev/null; then
# go test -covermode=count -coverprofile=$dir/profile.tmp $dir
# if [ -f $dir/profile.tmp ]; then
# cat $dir/profile.tmp | tail -n +2 >> profile.cov
# rm $dir/profile.tmp
# fi
#fi
#done
# To submit the test coverage result to coveralls.io,
# use goveralls (https://github.com/mattn/goveralls)