Merge PR #1341: Switch gometalinter to stable
* Switch gometalinter to stable * Delete empty folder
This commit is contained in:
parent
c3c570898d
commit
15bba919e2
|
@ -61,14 +61,13 @@ jobs:
|
|||
name: Get metalinter
|
||||
command: |
|
||||
export PATH="$GOBIN:$PATH"
|
||||
go get -u github.com/tendermint/lint/golint
|
||||
go get -u github.com/alecthomas/gometalinter
|
||||
make get_tools
|
||||
- run:
|
||||
name: Lint source
|
||||
command: |
|
||||
export PATH="$GOBIN:$PATH"
|
||||
gometalinter --disable-all --enable='golint' --vendor ./...
|
||||
|
||||
gometalinter.v2 --disable-all --enable='golint' --vendor ./...
|
||||
|
||||
test_unit:
|
||||
<<: *defaults
|
||||
parallelism: 4
|
||||
|
@ -84,7 +83,7 @@ jobs:
|
|||
command: |
|
||||
export PATH="$GOBIN:$PATH"
|
||||
make test_unit
|
||||
|
||||
|
||||
test_cli:
|
||||
<<: *defaults
|
||||
parallelism: 1
|
||||
|
@ -100,7 +99,7 @@ jobs:
|
|||
command: |
|
||||
export PATH="$GOBIN:$PATH"
|
||||
make test_cli_retry
|
||||
|
||||
|
||||
test_cover:
|
||||
<<: *defaults
|
||||
parallelism: 4
|
||||
|
|
|
@ -21,6 +21,7 @@ FEATURES
|
|||
* Proposals need deposits to be votable; deposits are burned if proposal fails
|
||||
* Delegators delegate votes to validator by default but can override (for their stake)
|
||||
* [tools] make get_tools installs tendermint's linter, and gometalinter
|
||||
* [tools] Switch gometalinter to the stable version
|
||||
|
||||
FIXES
|
||||
* \#1259 - fix bug where certain tests that could have a nil pointer in defer
|
||||
|
|
2
Makefile
2
Makefile
|
@ -108,7 +108,7 @@ test_cover:
|
|||
@bash tests/test_cover.sh
|
||||
|
||||
test_lint:
|
||||
gometalinter --disable-all --enable='golint' --vendor ./...
|
||||
gometalinter.v2 --disable-all --enable='golint' --vendor ./...
|
||||
|
||||
benchmark:
|
||||
@go test -bench=. $(PACKAGES_NOCLITEST)
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/alecthomas/gometalinter"
|
||||
packages = ["."]
|
||||
revision = "46cc1ea3778b247666c2949669a3333c532fa9c6"
|
||||
version = "v2.0.5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/alecthomas/units"
|
||||
packages = ["."]
|
||||
revision = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/google/shlex"
|
||||
packages = ["."]
|
||||
revision = "6f45313302b9c56850fc17f99e40caebce98c716"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/nicksnyder/go-i18n"
|
||||
packages = [
|
||||
"i18n",
|
||||
"i18n/bundle",
|
||||
"i18n/language",
|
||||
"i18n/translation"
|
||||
]
|
||||
revision = "0dc1626d56435e9d605a29875701721c54bc9bbd"
|
||||
version = "v1.10.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pelletier/go-toml"
|
||||
packages = ["."]
|
||||
revision = "acdc4509485b587f5e675510c4f2c63e90ff68a8"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "v3-unstable"
|
||||
name = "gopkg.in/alecthomas/kingpin.v3-unstable"
|
||||
packages = ["."]
|
||||
revision = "b8d601de6db1f3b56a99ffe9051eb708574bc1cd"
|
||||
|
||||
[[projects]]
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "7f97868eec74b32b0982dd158a51a446d1da7eb5"
|
||||
version = "v2.1.1"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "bb8cda576a5c4dda202435f43a46ae50a254181a4bf22c6af6f4d3d03079d509"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
|
@ -1,34 +0,0 @@
|
|||
# Gopkg.toml example
|
||||
#
|
||||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
||||
# for detailed Gopkg.toml documentation.
|
||||
#
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project"
|
||||
# version = "1.0.0"
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project2"
|
||||
# branch = "dev"
|
||||
# source = "github.com/myfork/project2"
|
||||
#
|
||||
# [[override]]
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
#
|
||||
# [prune]
|
||||
# non-go = false
|
||||
# go-tests = true
|
||||
# unused-packages = true
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/alecthomas/gometalinter"
|
||||
version = "2.0.5"
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
all: install
|
||||
all: get_tools
|
||||
|
||||
|
||||
########################################
|
||||
|
@ -6,10 +6,10 @@ all: install
|
|||
|
||||
DEP = github.com/golang/dep/cmd/dep
|
||||
GOLINT = github.com/tendermint/lint/golint
|
||||
GOMETALINTER = github.com/alecthomas/gometalinter
|
||||
GOMETALINTER = gopkg.in/alecthomas/gometalinter.v2
|
||||
DEP_CHECK := $(shell command -v dep 2> /dev/null)
|
||||
GOLINT_CHECK := $(shell command -v golint 2> /dev/null)
|
||||
GOMETALINTER_CHECK := $(shell command -v gometalinter 2> /dev/null)
|
||||
GOMETALINTER_CHECK := $(shell command -v gometalinter.v2 2> /dev/null)
|
||||
|
||||
check_tools:
|
||||
ifndef DEP_CHECK
|
||||
|
@ -42,9 +42,9 @@ else
|
|||
go get -v $(GOLINT)
|
||||
endif
|
||||
ifdef GOMETALINTER_CHECK
|
||||
@echo "Gometalinter is already installed. Run 'make update_tools' to update."
|
||||
@echo "Gometalinter.v2 is already installed. Run 'make update_tools' to update."
|
||||
else
|
||||
@echo "Installing gometalinter"
|
||||
@echo "Installing gometalinter.v2"
|
||||
go get -v $(GOMETALINTER)
|
||||
endif
|
||||
|
||||
|
@ -53,30 +53,10 @@ update_tools:
|
|||
go get -u -v $(DEP)
|
||||
@echo "Updating tendermint/golint"
|
||||
go get -u -v $(GOLINT)
|
||||
@echo "Updating gometalinter"
|
||||
@echo "Updating gometalinter.v2"
|
||||
go get -u -v $(GOMETALINTER)
|
||||
|
||||
|
||||
########################################
|
||||
### Install tools
|
||||
|
||||
|
||||
get_vendor_deps: check_tools
|
||||
@rm -rf vendor/
|
||||
@echo "--> Running dep ensure"
|
||||
@dep ensure -v
|
||||
|
||||
install: get_vendor_deps
|
||||
@echo "Installing tools"
|
||||
@echo "Install go-vendorinstall"
|
||||
go build -o bin/go-vendorinstall go-vendorinstall/*.go
|
||||
|
||||
@echo "Install gometalinter.v2"
|
||||
GOBIN="$(CURDIR)/bin" ./bin/go-vendorinstall github.com/alecthomas/gometalinter
|
||||
|
||||
@echo "Done installing tools"
|
||||
|
||||
# To avoid unintended conflicts with file names, always add to .PHONY
|
||||
# unless there is a reason not to.
|
||||
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
|
||||
.PHONY: check_tools install_tools update_tools get_vendor_deps install
|
||||
.PHONY: check_tools get_tools update_tools
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
// https://raw.githubusercontent.com/roboll/go-vendorinstall/a3e9f0a5d5861b3bb16b93200b2c359c9846b3c5/main.go
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
source = flag.String("source", "vendor", "source directory")
|
||||
target = flag.String("target", "", "target directory (defaults to $GOBIN, if not set $GOPATH/bin)")
|
||||
commands = flag.String("commands", "", "comma separated list of commands to execute after go install in temporary environment")
|
||||
quiet = flag.Bool("quiet", false, "disable output")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
packages := flag.Args()
|
||||
if len(packages) < 1 {
|
||||
fail(errors.New("no packages: specify a package"))
|
||||
}
|
||||
|
||||
gopath, err := ioutil.TempDir("", "go-vendorinstall-gopath")
|
||||
if err != nil {
|
||||
fail(err)
|
||||
}
|
||||
print(fmt.Sprintf("gopath: %s", gopath))
|
||||
defer func() {
|
||||
if err := os.RemoveAll(gopath); err != nil {
|
||||
fail(err)
|
||||
}
|
||||
}()
|
||||
|
||||
if len(*target) == 0 {
|
||||
if gobin := os.Getenv("GOBIN"); len(gobin) > 0 {
|
||||
target = &gobin
|
||||
} else {
|
||||
bin := fmt.Sprintf("%s/bin", os.Getenv("GOPATH"))
|
||||
target = &bin
|
||||
}
|
||||
}
|
||||
|
||||
gobin, err := filepath.Abs(*target)
|
||||
if err != nil {
|
||||
fail(err)
|
||||
}
|
||||
print(fmt.Sprintf("gobin: %s", gobin))
|
||||
|
||||
if err := link(gopath, *source); err != nil {
|
||||
fail(err)
|
||||
}
|
||||
|
||||
oldpath := os.Getenv("PATH")
|
||||
path := fmt.Sprintf("%s%s%s", gobin, string(os.PathListSeparator), os.Getenv("PATH"))
|
||||
os.Setenv("PATH", fmt.Sprintf("%s%s%s", gobin, string(os.PathListSeparator), os.Getenv("PATH")))
|
||||
defer os.Setenv("PATH", oldpath)
|
||||
|
||||
env := []string{fmt.Sprintf("PATH=%s", path), fmt.Sprintf("GOPATH=%s", gopath), fmt.Sprintf("GOBIN=%s", gobin)}
|
||||
args := append([]string{"install"}, packages...)
|
||||
if out, err := doexec("go", gopath, args, env); err != nil {
|
||||
print(string(out))
|
||||
fail(err)
|
||||
}
|
||||
|
||||
if len(*commands) > 0 {
|
||||
for _, cmd := range strings.Split(*commands, ",") {
|
||||
split := strings.Split(cmd, " ")
|
||||
if out, err := doexec(split[0], gopath, split[1:], env); err != nil {
|
||||
print(string(out))
|
||||
fail(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func print(msg string) {
|
||||
if !*quiet {
|
||||
fmt.Println(msg)
|
||||
}
|
||||
}
|
||||
|
||||
func fail(err error) {
|
||||
fmt.Printf("error: %s", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func link(gopath, source string) error {
|
||||
srcdir, err := filepath.Abs(source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
linkto := filepath.Join(gopath, "src")
|
||||
if err := os.MkdirAll(linkto, 0777); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
files, err := ioutil.ReadDir(srcdir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
real := filepath.Join(srcdir, file.Name())
|
||||
link := filepath.Join(linkto, file.Name())
|
||||
if err := os.Symlink(real, link); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func doexec(bin, dir string, args []string, env []string) ([]byte, error) {
|
||||
print(fmt.Sprintf("%s %s", bin, strings.Join(args, " ")))
|
||||
cmd := exec.Command(bin, args...)
|
||||
cmd.Env = env
|
||||
cmd.Dir = dir
|
||||
|
||||
return cmd.CombinedOutput()
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package main
|
||||
|
||||
// Include dependencies here so dep picks them up
|
||||
// and installs sub-dependencies.
|
||||
|
||||
// TODO: Ideally this gets auto-imported on dep update.
|
||||
// Any way to make that happen?
|
||||
// NOTE: problems with this import because its a main not a lib
|
||||
// _ "github.com/alecthomas/gometalinter"
|
||||
|
||||
func main() {}
|
Loading…
Reference in New Issue