.travis, build: minor polishes, disable deadcode

This commit is contained in:
Péter Szilágyi 2017-11-09 12:28:25 +02:00
parent 4af254252a
commit d79643167f
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D
2 changed files with 10 additions and 15 deletions

View file

@ -50,11 +50,13 @@ matrix:
- go run build/ci.go install - go run build/ci.go install
- go run build/ci.go test -coverage - go run build/ci.go test -coverage
# This only tests code linters on latest version of Go # This builder only tests code linters on latest version of Go
- os: linux - os: linux
dist: trusty dist: trusty
sudo: required sudo: required
go: 1.9.x go: 1.9.x
env:
- lint
script: script:
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install fuse - sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install fuse
- sudo modprobe fuse - sudo modprobe fuse

View file

@ -24,8 +24,8 @@ Usage: go run ci.go <command> <command flags/arguments>
Available commands are: Available commands are:
install [ -arch architecture ] [ packages... ] -- builds packages and executables install [ -arch architecture ] [ packages... ] -- builds packages and executables
test [ -coverage ] [ packages... ] -- runs the tests test [ -coverage ] [ packages... ] -- runs the tests
lint -- runs linters lint -- runs certain pre-selected linters
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -upload dest ] -- archives build artefacts
importkeys -- imports signing keys from env importkeys -- imports signing keys from env
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
@ -57,8 +57,8 @@ import (
"runtime" "runtime"
"strings" "strings"
"time" "time"
"github.com/ethereum/go-ethereum/internal/build"
"github.com/ethereum/go-ethereum/internal/build"
) )
var ( var (
@ -312,26 +312,19 @@ func doTest(cmdline []string) {
// runs gometalinter on requested packages // runs gometalinter on requested packages
func doLint(cmdline []string) { func doLint(cmdline []string) {
flag.CommandLine.Parse(cmdline) flag.CommandLine.Parse(cmdline)
packages := []string{"./..."} packages := []string{"./..."}
if len(flag.CommandLine.Args()) > 0 { if len(flag.CommandLine.Args()) > 0 {
packages = flag.CommandLine.Args() packages = flag.CommandLine.Args()
for _, pkg := range packages {
packages = append(packages, fmt.Sprintf("%s/...", pkg));
}
} }
// Get metalinter and install all supported linters
//get metalinter and install linters
build.MustRun(goTool("get", "gopkg.in/alecthomas/gometalinter.v1")) build.MustRun(goTool("get", "gopkg.in/alecthomas/gometalinter.v1"))
build.MustRunCommand(filepath.Join(GOBIN,"gometalinter.v1"), "--install") build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), "--install")
configs := []string{"--vendor", "--disable-all", "--enable=vet", "--enable=deadcode"} // Add additional linters to the slice with "--enable=linter-name" configs := []string{"--vendor", "--disable-all", "--enable=vet"} // Add additional linters to the slice with "--enable=linter-name"
build.MustRunCommand(filepath.Join(GOBIN,"gometalinter.v1"), append(configs, packages...)...) build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), append(configs, packages...)...)
} }
// Release Packaging // Release Packaging