build: replace travis-ci with github actions.

test go 1.14
use golangci-lint
This commit is contained in:
David Hill 2020-05-13 08:44:07 -04:00
parent b470eee477
commit a505b99ba3
7 changed files with 45 additions and 46 deletions

27
.github/workflows/go.yml vendored Normal file
View file

@ -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

View file

@ -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

View file

@ -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).

View file

@ -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"`
}

View file

@ -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

View file

@ -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) {

View file

@ -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,