diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000..f722032b --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,27 @@ +name: Build and Test +on: [push, pull_request] +jobs: + build: + name: Go CI + runs-on: ubuntu-latest + strategy: + matrix: + go: [1.13, 1.14] + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - name: Check out source + uses: actions/checkout@v2 + - name: Install Linters + run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.26.0" + - name: Build + env: + GO111MODULE: "on" + run: go build ./... + - name: Test + env: + GO111MODULE: "on" + run: | + sh ./goclean.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5a611c39..00000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go -cache: - directories: - - $GOCACHE - - $GOPATH/pkg/mod - - $GOPATH/github.com/golang - - $GOPATH/gopkg.in/alecthomas -go: - - "1.13.x" -sudo: false -install: - - export PATH=$PATH:$PWD/linux-amd64/ - - GO111MODULE=on go install . ./cmd/... - - GO111MODULE=off go get -u gopkg.in/alecthomas/gometalinter.v2 - - GO111MODULE=off gometalinter.v2 --install -script: - - export PATH=$PATH:$HOME/gopath/bin - - ./goclean.sh diff --git a/README.md b/README.md index a270fd2e..8c9d252a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ btcd ==== -[![Build Status](https://travis-ci.org/btcsuite/btcd.png?branch=master)](https://travis-ci.org/btcsuite/btcd) -[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) -[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/btcsuite/btcd) +[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions) +[![ISC License](https://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) +[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/btcsuite/btcd) btcd is an alternative full node bitcoin implementation written in Go (golang). diff --git a/btcjson/chainsvrresults.go b/btcjson/chainsvrresults.go index 8cd716d4..d076b746 100644 --- a/btcjson/chainsvrresults.go +++ b/btcjson/chainsvrresults.go @@ -271,7 +271,7 @@ type GetBlockTemplateResult struct { type MempoolFees struct { Base float64 `json:"base"` - Modified float64 `json:"base"` + Modified float64 `json:"modified"` Ancestor float64 `json:"ancestor"` Descendant float64 `json:"descendant"` } diff --git a/goclean.sh b/goclean.sh index 6d0e0ca1..4689ab36 100755 --- a/goclean.sh +++ b/goclean.sh @@ -6,26 +6,16 @@ # 4. gosimple (https://github.com/dominikh/go-simple) # 5. unconvert (https://github.com/mdempsky/unconvert) # -# gometalinter (github.com/alecthomas/gometalinter) is used to run each static -# checker. set -ex -# Make sure gometalinter is installed and $GOPATH/bin is in your path. -# $ go get -v github.com/alecthomas/gometalinter" -# $ gometalinter --install" -if [ ! -x "$(type -p gometalinter.v2)" ]; then - exit 1 -fi - -linter_targets=$(go list ./...) +go test -tags="rpctest" ./... # Automatic checks -test -z "$(gometalinter.v2 -j 4 --disable-all \ +golangci-lint run --deadline=10m --disable-all \ --enable=gofmt \ --enable=golint \ --enable=vet \ --enable=gosimple \ ---enable=unconvert \ ---deadline=10m $linter_targets 2>&1 | grep -v 'ALL_CAPS\|OP_' 2>&1 | tee /dev/stderr)" -GO111MODULE=on go test -tags="rpctest" $linter_targets +--enable=unconvert + diff --git a/mempool/mempool_test.go b/mempool/mempool_test.go index 84aee10a..6d43cfd8 100644 --- a/mempool/mempool_test.go +++ b/mempool/mempool_test.go @@ -1418,8 +1418,8 @@ func TestAncestorsDescendants(t *testing.T) { // We'll be querying for the ancestors of E. We should expect to see all // of the transactions that it depends on. expectedAncestors := map[chainhash.Hash]struct{}{ - *a.Hash(): struct{}{}, *b.Hash(): struct{}{}, - *c.Hash(): struct{}{}, *d.Hash(): struct{}{}, + *a.Hash(): {}, *b.Hash(): {}, + *c.Hash(): {}, *d.Hash(): {}, } ancestors := ctx.harness.txPool.txAncestors(e, nil) if len(ancestors) != len(expectedAncestors) { @@ -1436,8 +1436,8 @@ func TestAncestorsDescendants(t *testing.T) { // Then, we'll query for the descendants of A. We should expect to see // all of the transactions that depend on it. expectedDescendants := map[chainhash.Hash]struct{}{ - *b.Hash(): struct{}{}, *c.Hash(): struct{}{}, - *d.Hash(): struct{}{}, *e.Hash(): struct{}{}, + *b.Hash(): {}, *c.Hash(): {}, + *d.Hash(): {}, *e.Hash(): {}, } descendants := ctx.harness.txPool.txDescendants(a, nil) if len(descendants) != len(expectedDescendants) { diff --git a/txscript/pkscript_test.go b/txscript/pkscript_test.go index 841842c2..49e2db8a 100644 --- a/txscript/pkscript_test.go +++ b/txscript/pkscript_test.go @@ -337,9 +337,9 @@ func TestComputePkScript(t *testing.T) { name: "P2WSH witness", sigScript: nil, witness: [][]byte{ - []byte{}, + {}, // Witness script. - []byte{ + { 0x21, 0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce, 0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c, 0x60, 0x72, 0xef, 0xea, 0x86, @@ -367,9 +367,9 @@ func TestComputePkScript(t *testing.T) { witness: [][]byte{ // Signature is not needed to re-derive the // pkScript. - []byte{}, + {}, // Compressed pubkey. - []byte{ + { 0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce, 0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c, 0x60, 0x72, 0xef, 0xea, 0x86, 0xd0, @@ -398,9 +398,9 @@ func TestComputePkScript(t *testing.T) { witness: [][]byte{ // Signature is not needed to re-derive the // pkScript. - []byte{}, + {}, // Malformed compressed pubkey. - []byte{ + { 0x03, 0x82, 0x62, 0xa6, 0xc6, 0xce, 0xc9, 0x3c, 0x2d, 0x3e, 0xcd, 0x6c, 0x60, 0x72, 0xef, 0xea, 0x86, 0xd0,