diff --git a/.gitignore b/.gitignore index 8005af0..a309b10 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,8 @@ password.txt # Ignore Build release /build/_workspace/ -/build/cache/ +/build/.cache/ /build/bin/ +/build/dist/ build/_vendor/pkg cert diff --git a/.travis.yml b/.travis.yml index 998f263..03e964f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ jobs: env: - GO111MODULE=on script: - - go run utils/ci.go install + - go run utils/ci.go build - go run utils/ci.go test -coverage $TEST_PACKAGES - stage: build @@ -36,7 +36,7 @@ jobs: env: - GO111MODULE=on script: - - go run utils/ci.go install + - go run utils/ci.go build - go run utils/ci.go test -coverage $TEST_PACKAGES diff --git a/Makefile b/Makefile index 2914d61..a108fdc 100644 --- a/Makefile +++ b/Makefile @@ -1,62 +1,108 @@ -BINARY := godbledger VERSION ?= latest -PLATFORMS := linux -os = $(word 1, $@) -GOBIN = ./build/bin GO ?= latest +GODIST = ./build/dist +GO ?= latest GORUN = env GO111MODULE=on go run -.PHONY: $(PLATFORMS) -$(PLATFORMS): - mkdir -p release/$(BINARY)-$(os)-x64-v$(VERSION)/ - GOOS=$(os) GOARCH=amd64 GO111MODULE=on go build -o release/$(BINARY)-$(os)-x64-v$(VERSION)/ ./... +xtarget = $(strip $(subst build-,,$@)) # e.g. 'build-linux-amd64' -> 'linux-amd64' +xdest = $(GODIST)/$(xtarget) -.PHONY: release -release: linux +# 'default' target builds all binaries for local development/testing +default: build-native + +# 'release' target builds os-specific builds of only godbledger using xgo/docker +release: build-cross -PHONY: clean clean: + rm -rf build/.cache + rm -rf build/bin + rm -rf build/dist rm -rf release/ rm -rf cert/ +build-native: + $(GORUN) utils/ci.go build + lint: - GO111MODULE=on go run utils/ci.go lint + $(GORUN) utils/ci.go lint + +# our tests include an integration test which expects the local +# GOOS-based build output to be in the ./build/bin folder +test: build-native + $(GORUN) utils/ci.go test -travis: - GO111MODULE=on go run utils/ci.go install - GO111MODULE=on go run utils/ci.go test -coverage $$TEST_PACKAGES +travis: build-native + $(GORUN) utils/ci.go test -coverage $$TEST_PACKAGES + +# ------------------------------------- +# release_pattern=current +# +linux: + mkdir -p release/godbledger-linux-x64-v$(VERSION)/ + GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o release/godbledger-linux-x64-v$(VERSION)/ ./... linux-arm-7: - mkdir -p release/$(BINARY)-arm7-v$(VERSION)/ - env CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 GO111MODULE=on go build -o release/$(BINARY)-arm7-v$(VERSION)/ ./... + mkdir -p release/godbledger-arm7-v$(VERSION)/ + env CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 GO111MODULE=on go build -o release/godbledger-arm7-v$(VERSION)/ ./... linux-arm-64: - mkdir -p release/$(BINARY)-arm64-v$(VERSION)/ - env CC=aarch64-linux-gnu-gcc CXX=aarch-linux-gnu-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm64 GO111MODULE=on go build -o release/$(BINARY)-arm64-v$(VERSION)/ ./... + mkdir -p release/godbledger-arm64-v$(VERSION)/ + env CC=aarch64-linux-gnu-gcc CXX=aarch-linux-gnu-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm64 GO111MODULE=on go build -o release/godbledger-arm64-v$(VERSION)/ ./... +# ------------------------------- + +build-cross: build-linux build-darwin build-windows -godbledger-linux-arm: godbledger-linux-arm-5 godbledger-linux-arm-6 godbledger-linux-arm-7 godbledger-linux-arm64 +build-linux: build-linux-386 build-linux-amd64 build-linux-arm + @echo "Linux cross compilation done:" + @ls -ld $(GODIST)/linux-* + +build-linux-386: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target linux/386 -- --go=$(GO) + +build-linux-amd64: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target linux/amd64 -- --go=$(GO) + +build-linux-arm: build-linux-arm-5 build-linux-arm-6 build-linux-arm-7 build-linux-arm64 @echo "Linux ARM cross compilation done:" - @ls -ld $(GOBIN)/godbledger-linux-* | grep arm - -godbledger-linux-arm-5: - $(GORUN) utils/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./.. - @echo "Linux ARMv5 cross compilation done:" - @ls -ld $(GOBIN)/godbledger-linux-* | grep arm-5 - -godbledger-linux-arm-6: - $(GORUN) utils/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./godbledger - @echo "Linux ARMv6 cross compilation done:" - @ls -ld $(GOBIN)/godbledger-linux-* | grep arm-6 - -godbledger-linux-arm-7: - $(GORUN) utils/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./godbledger - @echo "Linux ARMv7 cross compilation done:" - @ls -ld $(GOBIN)/godbledger-linux-* | grep arm-7 - -godbledger-linux-arm64: - $(GORUN) utils/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./godbledger - @echo "Linux ARM64 cross compilation done:" - @ls -ld $(GOBIN)/godbledger-linux-* | grep arm64 + @ls -ld $(GODIST)/linux-arm* + +build-linux-arm-5: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target linux/arm-5 -- --go=$(GO) + +build-linux-arm-6: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target linux/arm-6 -- --go=$(GO) + +build-linux-arm-7: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target linux/arm-7 -- --go=$(GO) + +build-linux-arm64: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target linux/arm64 -- --go=$(GO) + +build-darwin: build-darwin-10.6-amd64 + @echo "Darwin cross compilation done:" + @ls -ld $(GODIST)/darwin-* + +build-darwin-10.6-amd64: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target darwin-10.6/amd64 -- --go=$(GO) + +build-windows: build-windows-4.0-386 build-windows-4.0-amd64 + @echo "Windows cross compilation done:" + @ls -ld $(GODIST)/windows-* + +build-windows-4.0-386: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target windows-4.0/386 -- --go=$(GO) + +build-windows-4.0-amd64: + @echo "building $(xtarget)" + $(GORUN) utils/ci.go xgo --target windows-4.0/amd64 -- --go=$(GO) .PHONY: cert cert: diff --git a/README.md b/README.md index d64c696..e0dab22 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Go DB Ledger +# Go DB Ledger GoDBLedger is an open source accounting system that aims to make the recording of double entry bookkeeping transactions programmable. It provide users with normal features that most finance systems tend to lack such as api endpoints for your scripts and a database backend with a clear schema so you can analyse your financial data using your software of choice. The ultimate goal is for your whole financial process to be automated from data entry to compilation of financials/tax returns. @@ -26,7 +26,7 @@ https://discord.gg/xHFufYC | `Ledger_cli` | A CLI client that can be used to transmit transactions to the server. | | `Reporter` | Builds basic reports from the database on the command line. | -### Communicating with Godbledger and software examples +## Communicating with Godbledger and software examples **GRPC and Proto Buffers** The primary way to communicate with Godbledger is through the GRPC endpoint, submitting a transaction that contains your journal entry/transaction. @@ -59,7 +59,7 @@ The PDF files are generated from [handlebars](https://handlebarsjs.com/) iterati Templates can be viewed [here](https://github.com/darcys22/pdf-generator) -### Database and configuration +## Database and configuration Godbledger will set a default configuration if none has been provided using Sqlite3 as the default database. @@ -68,13 +68,13 @@ The config file can be found by default at: ~/.ledger/config.toml ``` -### Building the Proto Buffers +## Building the Proto Buffers Call from the root directory ``` protoc -I proto/ proto/transaction.proto --go_out=plugins=grpc:proto ``` -### SQL Querys +## SQL Querys default stored location for database is .ledger/ledgerdata `sqlite3 ledger.db` **Select all transactions** @@ -89,6 +89,73 @@ SELECT * FROM accounts where account_id in (select account_id from account_tag w ``` +## Contributing + +### Local Development + +1. Install golang version 1.13 or higher for your OS and architecture: + + - https://golang.org/doc/install + +1. To build the `godbledger` executables natively for your OS and architecture you can simply use Make + + ``` + make + ``` + + The default make target is `build-native` which builds binaries native to your environment into the `./build/bin/native/` folder. + + NOTE: on windows you may need to install a C++ tool chain (e.g. [`tdm-gcc`](https://jmeubank.github.io/tdm-gcc/)) in order to cross compile the sqlite dependency. + + After building you can run the version you just built: + + ``` + ./build/bin/native/godbledger + ``` + +1. Run the linter to discover any style or structural errors: + + ``` + make lint + ``` + +1. Run the tests + + ``` + make test + ``` + + NOTE: the test suite depends on the `build-native` target as it includes an integration test which spins up an instance of `godbledger` + +### Build architecture + +The primary entrypoint into the build scripts is the `Makefile` which provides the aforementioned build targets: +- `build-native` (default) +- `lint` +- `test` + +All three of which call into the `./utils/ci.go` script to do the actual work of setting up required env vars, building the executiables, and configuring output folders. + +An additional `./utils/make-release.sh` script is available to help orchestrate the creation of zip/tarfiles. + +### Cross-compiling with xgo/docker + +In addition to the default, native build target, the `Makefile` also offers a `build-cross` target which uses a forked version of `xgo` (https://github.com/techknowlogick/xgo) to build for different operating systems and architectures, including linux variants, a MacOS-compatible binary, and windows-compatible exe files. + +``` +make build-cross +``` + +Go tooling natively offers cross-compiling features when the `CGO_ENABLED=0` flag is set; `godbledger`'s `go-sqlite3` dependency however requires `CGO_ENABLED=1` in order to link in the C-level bindings for SQLite. Cross-compiling golang when `CGO` is enable is significantly more complicated as each platform and architecture can require a custom C++ toolchain. + +`xgo` achieves consistency in cross-compilation using Docker, so running Docker Engine on your dev box is a requirement to running the `build-cross` target. + +#### Install Docker Engine + +The Docker web site includes detailed instructions on [installing and running Docker Engine](https://docs.docker.com/engine/install/) on a variety of supported platforms. + +NOTE: if installing Docker Engine on a linux system make sure to follow the [Post-installation steps for Linux](https://docs.docker.com/engine/install/linux-postinstall/) in order to be able to run `docker` commands from local user accounts. + ### TODO/Milestones - ~~GoDBLedger server runs and accepts transactions~~ - ~~trial balance and transaction reports of journals~~ diff --git a/go.mod b/go.mod index a168f28..1d6b668 100644 --- a/go.mod +++ b/go.mod @@ -4,24 +4,25 @@ go 1.13 require ( github.com/BurntSushi/toml v0.3.1 - github.com/cespare/cp v1.1.1 // indirect - github.com/ethereum/go-ethereum v1.9.15 github.com/go-sql-driver/mysql v1.5.0 - github.com/gogo/protobuf v1.1.1 github.com/golang/protobuf v1.4.2 - github.com/gophers/xgo v0.0.0-20200104073656-1317f74b9001 // indirect github.com/joyt/godate v0.0.0-20150226210126-7151572574a7 - github.com/karalabe/xgo v0.0.0-20191115072854-c5ccff8648a7 // indirect + github.com/kr/pretty v0.1.0 // indirect github.com/marcmak/calc v0.0.0-20150509200512-5bbbfc3b3149 github.com/mattn/go-colorable v0.1.7 github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/olekukonko/tablewriter v0.0.4 + github.com/onsi/ginkgo v1.7.0 // indirect + github.com/onsi/gomega v1.4.3 // indirect github.com/rs/xid v1.2.1 github.com/sirupsen/logrus v1.6.0 github.com/stretchr/testify v1.4.0 github.com/urfave/cli/v2 v2.2.0 github.com/x-cray/logrus-prefixed-formatter v0.5.2 + golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4 // indirect + golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 // indirect + golang.org/x/text v0.3.2 // indirect google.golang.org/grpc v1.30.0 - src.techknowlogick.com/xgo v1.0.1-0.20200717030703-5c3bb7fc435e // indirect + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) diff --git a/go.sum b/go.sum index c66c768..dd70ad4 100644 --- a/go.sum +++ b/go.sum @@ -1,72 +1,24 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= -github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= -github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU= -github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/dop251/goja v0.0.0-20200219165308-d1232e640a87/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.9.15 h1:wrWl+QrtutRUJ9LZXdUqBoGoo2b1tOCYRDrAOQhCY3A= -github.com/ethereum/go-ethereum v1.9.15/go.mod h1:slT8bPPRhXsyNTwHQxrOnjuTZ1sDXRajW11EkJ84QJ0= -github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -76,106 +28,58 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/gophers/xgo v0.0.0-20200104073656-1317f74b9001 h1:5UcJnp2/fZ9MGc8O9Tb3mBXr+WMd2hUpdlfFWv90MaU= -github.com/gophers/xgo v0.0.0-20200104073656-1317f74b9001/go.mod h1:HENK69XtUT+Fbtp4t7ijgCw8c5khHVOuzzzZcKGC57A= -github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= -github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joyt/godate v0.0.0-20150226210126-7151572574a7 h1:2wH5antjhmU3EuWyidm0lJ4B9hGMpl5lNRo+M9uGJ5A= github.com/joyt/godate v0.0.0-20150226210126-7151572574a7/go.mod h1:R+UgFL3iylLhx9N4w35zZ2HdhDlgorRDx4SxbchWuN0= -github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/karalabe/xgo v0.0.0-20191115072854-c5ccff8648a7 h1:AYzjK/SHz6m6mg5iuFwkrAhCc14jvCpW9d6frC9iDPE= -github.com/karalabe/xgo v0.0.0-20191115072854-c5ccff8648a7/go.mod h1:iYGcTYIPUvEWhFo6aKUuLchs+AV4ssYdyuBbQJZGcBk= +github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/marcmak/calc v0.0.0-20150509200512-5bbbfc3b3149 h1:QaKQMdY9TmwTq+UPXBo1hGi95iguDE7q7sPvt6RqLiA= github.com/marcmak/calc v0.0.0-20150509200512-5bbbfc3b3149/go.mod h1:op87dInbDFPr69TsmmZoW0q4hj8LV8VZYaG4p1rDzLY= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8= github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= -github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shirou/gopsutil v2.20.5-0.20200531151128-663af789c085+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= -github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA= -github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4= github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg= github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= @@ -189,7 +93,6 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -202,7 +105,6 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -215,12 +117,12 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -239,19 +141,15 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200603215123-a4a8cb9d2cbc/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -src.techknowlogick.com/xgo v1.0.1-0.20200717030703-5c3bb7fc435e h1:cNlfcCyMwIq/KyKPgpuPohdDr9EjtxX0b44sGYSV2Ic= -src.techknowlogick.com/xgo v1.0.1-0.20200717030703-5c3bb7fc435e/go.mod h1:31CE1YKtDOrKTk9PSnjTpe6YbO6W/0LTYZ1VskL09oU= diff --git a/tests/components/godbledger_node.go b/tests/components/godbledger_node.go index fe5e946..3fa017d 100644 --- a/tests/components/godbledger_node.go +++ b/tests/components/godbledger_node.go @@ -4,6 +4,7 @@ package components import ( "os/exec" + //"strings" "fmt" "strings" @@ -30,7 +31,7 @@ func StartGoDBLedger(t *testing.T, config *cmd.LedgerConfig) int { fmt.Sprintf("--database-location=%s", config.DatabaseLocation), } - cmd := exec.Command("../build/bin/godbledger", args...) + cmd := exec.Command("../build/bin/native/godbledger", args...) t.Logf("Starting GoDBLedger with flags: %s", strings.Join(args[:], " ")) if err := cmd.Start(); err != nil { t.Fatalf("Failed to start GoDBLedger Server: %v", err) diff --git a/utils/ci.go b/utils/ci.go index f7b492a..4c6963b 100644 --- a/utils/ci.go +++ b/utils/ci.go @@ -53,9 +53,11 @@ import ( "os" "os/exec" "path/filepath" + //"regexp" "runtime" "strings" + //"time" //"github.com/cespare/cp" "github.com/darcys22/godbledger/godbledger/version" @@ -63,6 +65,14 @@ import ( ) var ( + // NOTE: this could be inferred if these 'main' packages were moved + // into a ./cmd folder (see: https://github.com/golang-standards/project-layout#cmd) + packagesToBuild = []string{ + "godbledger", + "ledger_cli", + "reporter", + } + // Files that end up in the godbledger*.zip archive. godbledgerArchiveFiles = []string{ executablePath("godbledger"), @@ -116,6 +126,22 @@ var ( ) var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin")) +var BUILDDIR, _ = filepath.Abs("build") + +func archBinPath(goos string, arch string) string { + if goos == runtime.GOOS && arch == runtime.GOARCH { + return filepath.Join(GOBIN, "native") + } + return filepath.Join(GOBIN, fmt.Sprintf("%s-%s", goos, arch)) +} + +func cachePath() string { + return filepath.Join(BUILDDIR, ".cache") +} + +func distPath() string { + return filepath.Join(BUILDDIR, "dist") +} func executablePath(name string) string { if runtime.GOOS == "windows" { @@ -134,8 +160,10 @@ func main() { log.Fatal("need subcommand as first argument") } switch os.Args[1] { - case "install": - doInstall(os.Args[2:]) + case "info": + log.Printf("current system: %s/%s", runtime.GOOS, runtime.GOARCH) + case "build": + doBuild(os.Args[2:]) case "test": doTest(os.Args[2:]) case "lint": @@ -157,16 +185,10 @@ func main() { // Compiling -func doInstall(cmdline []string) { - var ( - arch = flag.String("arch", "", "Architecture to cross build for") - cc = flag.String("cc", "", "C compiler to cross build with") - ) - flag.CommandLine.Parse(cmdline) - env := build.Env() - - // Check Go version. People regularly open issues about compilation - // failure with outdated Go. This should save them the trouble. +// ensureMinimumGoVersion ensures that the current go version is compatible with +// our build requirements. People regularly open issues about compilation failure +// with outdated Go; this should save them the trouble. +func ensureMinimumGoVersion() { if !strings.Contains(runtime.Version(), "devel") { // Figure out the minor version number since we can't textually compare (1.10 < 1.9) var minor int @@ -179,17 +201,36 @@ func doInstall(cmdline []string) { os.Exit(1) } } +} + +func doBuild(cmdline []string) { + var ( + goos = flag.String("os", runtime.GOOS, "OS to (cross) build for") + arch = flag.String("arch", runtime.GOARCH, "Architecture to (cross) build for") + cc = flag.String("cc", "", "C compiler to (cross) build with") + ) + flag.CommandLine.Parse(cmdline) + env := build.Env() + log.Printf("build targeting: %s/%s", *goos, *arch) + // Compile packages given as arguments, or everything if there are no arguments. packages := []string{"./..."} if flag.NArg() > 0 { packages = flag.Args() } - if *arch == "" || *arch == runtime.GOARCH { - goinstall := goTool("install", buildFlags(env)...) + ensureMinimumGoVersion() + + // ensure our output path exists so we can use the -o flag to dump build output there + os.MkdirAll(archBinPath(*goos, *arch), os.ModePerm) + + // native build can be done with plain go tools + if *goos == runtime.GOOS && *arch == runtime.GOARCH { + goinstall := goTool("build", buildFlags(env)...) if runtime.GOARCH == "arm64" { goinstall.Args = append(goinstall.Args, "-p", "1") } + goinstall.Args = append(goinstall.Args, []string{"-o", archBinPath(*goos, *arch)}...) goinstall.Args = append(goinstall.Args, "-v") goinstall.Args = append(goinstall.Args, packages...) build.MustRun(goinstall) @@ -297,7 +338,7 @@ func doTest(cmdline []string) { // doLint runs golangci-lint on requested packages. func doLint(cmdline []string) { var ( - cachedir = flag.String("cachedir", "./build/cache", "directory for caching golangci-lint binary.") + cachedir = flag.String("cachedir", cachePath(), "directory for caching golangci-lint binary.") ) flag.CommandLine.Parse(cmdline) packages := []string{"./..."} @@ -776,38 +817,54 @@ func (d debExecutable) Package() string { func doXgo(cmdline []string) { var ( - alltools = flag.Bool("alltools", false, `Flag whether we're building all known tools, or only on in particular`) + xtarget = flag.String("target", "", "cross-compile target") ) flag.CommandLine.Parse(cmdline) env := build.Env() + if *xtarget == "" || strings.Contains(*xtarget, "*") { + // TODO: not sure about this, limiting xgo to a single target, but it lets us manage the output to a target-based folder + log.Println("must supply a single xgo build target for cross-compliation") + os.Exit(1) + } + + targetSuffix := strings.ReplaceAll(*xtarget, "/", "-") + outDir := filepath.Join(distPath(), targetSuffix) + os.MkdirAll(outDir, os.ModePerm) + + log.Printf("xgo target [%s] --> %s\n", *xtarget, outDir) + // Make sure xgo is available for cross compilation - //gogetxgo := goTool("get", "github.com/techknowlogick/xgo") gogetxgo := goTool("get", "src.techknowlogick.com/xgo") build.MustRun(gogetxgo) - // If all tools building is requested, build everything the builder wants - args := append(buildFlags(env), flag.Args()...) - - if *alltools { - args = append(args, []string{"--dest", GOBIN}...) - for _, res := range allToolsArchiveFiles { - if strings.HasPrefix(res, GOBIN) { - // Binary tool found, cross build it explicitly - args = append(args, "./"+filepath.Base(res)) - xgo := xgoTool(args) - build.MustRun(xgo) - args = args[:len(args)-1] + for _, cmd := range packagesToBuild { + xgoArgs := append(buildFlags(env), flag.Args()...) + xgoArgs = append(xgoArgs, []string{"--targets", *xtarget}...) + xgoArgs = append(xgoArgs, []string{"--dest", outDir}...) + xgoArgs = append(xgoArgs, "-v") + xgoArgs = append(xgoArgs, "./"+cmd) // relative package name (assumes we are inside GOPATH) + xgo := xgoTool(xgoArgs) + build.MustRun(xgo) + + // strip the suffix out of the binary name + // TODO: add this ability into xgo + filepath.Walk(outDir, func(path string, info os.FileInfo, err error) error { + if info.IsDir() { + return nil // skip } - } - return - } - // Otherwise xxecute the explicit cross compilation - path := args[len(args)-1] - args = append(args[:len(args)-1], []string{"--dest", GOBIN, path}...) - xgo := xgoTool(args) - build.MustRun(xgo) + suffix := filepath.Base(filepath.Dir(path)) + if strings.HasPrefix(info.Name(), cmd) && strings.Contains(info.Name(), suffix) { + newName := strings.Replace(info.Name(), "-"+suffix, "", 1) + newPath := filepath.Join(filepath.Dir(path), newName) + log.Println("renaming:", path) + log.Println(" to:", newPath) + os.Rename(path, newPath) + } + return nil + }) + } } func xgoTool(args []string) *exec.Cmd { @@ -816,6 +873,23 @@ func xgoTool(args []string) *exec.Cmd { cmd.Env = append(cmd.Env, []string{ "GOBIN=" + GOBIN, }...) + if os.Getenv("GOPATH") == "" { + // xgo requires that $GOPATH be set + homeRel := os.Getenv("HOME") + if runtime.GOOS == "windows" { + homeRel = os.Getenv("USERPROFILE") + } + if homeRel == "" { + log.Println("GOPATH undefined and cannot determine homedir") + os.Exit(1) + } + homeAbs, _ := filepath.Abs(homeRel) + goPath := filepath.Join(homeAbs, "go") + log.Printf("GOPATH undefined but required by xgo; injecting %s\n", goPath) + cmd.Env = append(cmd.Env, []string{ + "GOPATH="+goPath, + }...) + } return cmd } diff --git a/utils/make-release.sh b/utils/make-release.sh index 5d5fb79..da039d4 100755 --- a/utils/make-release.sh +++ b/utils/make-release.sh @@ -1,8 +1,8 @@ #!/bin/bash +set -e + version=$1 -build=linux -#build=arm if [ -z "$version" ] then @@ -10,20 +10,34 @@ then exit fi -make VERSION=$version release -make VERSION=$version linux-arm-7 -make VERSION=$version linux-arm-64 - -WORKING_DIR=release/ - -echo "Working in $WORKING_DIR..." - -mkdir -p $WORKING_DIR -cd $WORKING_DIR - -tar -czvf godbledger-$build-x64-v$version.tar.gz godbledger-$build-x64-v$version -tar -czvf godbledger-arm7-v$version.tar.gz godbledger-arm7-v$version -tar -czvf godbledger-arm64-v$version.tar.gz godbledger-arm64-v$version +if [ "$release_pattern" == "xgo" ]; then + # to build all: make VERSION=$version build-cross + make VERSION=$version build-linux-amd64 + make VERSION=$version build-linux-arm-7 + make VERSION=$version build-linux-arm64 + + WORKING_DIR=release/ + echo "Working in $WORKING_DIR..." + mkdir -p $WORKING_DIR + cd $WORKING_DIR + + tar -czvf godbledger-linux-x64-v$version.tar.gz -C ../build/dist/linux-amd64 . + tar -czvf godbledger-arm7-v$version.tar.gz -C ../build/dist/linux-arm-7 . + tar -czvf godbledger-arm64-v$version.tar.gz -C ../build/dist/linux-arm64 . +else + make VERSION=$version linux + make VERSION=$version linux-arm-7 + make VERSION=$version linux-arm-64 + + WORKING_DIR=release/ + echo "Working in $WORKING_DIR..." + mkdir -p $WORKING_DIR + cd $WORKING_DIR + + tar -czvf godbledger-linux-x64-v$version.tar.gz godbledger-linux-x64-v$version + tar -czvf godbledger-arm7-v$version.tar.gz godbledger-arm7-v$version + tar -czvf godbledger-arm64-v$version.tar.gz godbledger-arm64-v$version +fi echo '#### sha256sum' sha256sum godbledger-*-v$version.tar.gz