Skip to content

Commit ab1d014

Browse files
committed
Merge remote-tracking branch 'origin/bugfix/init-cmd-overwrites-existing-files' into develop
2 parents 7ffb255 + d1ef5bf commit ab1d014

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

Makefile

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
.PHONY: get_deps build all list_deps install
2-
3-
all: get_deps install test
4-
51
TMROOT = $${TMROOT:-$$HOME/.tendermint}
6-
define NEWLINE
7-
2+
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
83

9-
endef
10-
NOVENDOR = go list github.com/tendermint/ethermint/... | grep -v /vendor/
4+
install: get_vendor_deps
5+
@go install ./cmd/ethermint
116

12-
install: get_deps
13-
go install github.com/tendermint/ethermint/cmd/ethermint
7+
test:
8+
@echo "--> Running go test"
9+
@go test `${PACKAGES}`
1410

15-
test: build
16-
go test `${NOVENDOR}`
17-
18-
test_race: build
19-
go test -race `${NOVENDOR}`
11+
test_race:
12+
@echo "--> Running go test --race"
13+
@go test -race `${PACKAGES}`
2014

2115
get_deps:
22-
go get -d `${NOVENDOR}`
23-
go list -f '{{join .TestImports "\n"}}' github.com/tendermint/ethermint/... | \
16+
@go get -d `${PACKAGES}`
17+
@go list -f '{{join .TestImports "\n"}}' ./... | \
2418
grep -v /vendor/ | sort | uniq | \
2519
xargs go get
2620

2721
get_vendor_deps:
2822
go get github.com/Masterminds/glide
29-
glide install --strip-vendor
23+
@echo "--> Running glide install"
24+
@glide install --strip-vendor
25+
26+
all: install test
27+
28+
.PHONY: get_deps get_vendor_deps install test test_race

cmd/ethermint/init.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ package main
33
import (
44
"os"
55

6-
. "github.com/tendermint/go-common"
6+
cmn "github.com/tendermint/go-common"
77
"github.com/tendermint/tendermint/types"
88
)
99

1010
func init_files() {
1111
// if no priv val, make it
1212
privValFile := config.GetString("priv_validator_file")
13-
if _, err := os.Stat(privValFile); err != nil {
13+
if _, err := os.Stat(privValFile); os.IsNotExist(err) {
1414
privValidator := types.GenPrivValidator()
1515
privValidator.SetFile(privValFile)
1616
privValidator.Save()
1717

1818
// if no genesis, make it using the priv val
1919
genFile := config.GetString("genesis_file")
20-
if _, err := os.Stat(genFile); err != nil {
20+
if _, err := os.Stat(genFile); os.IsNotExist(err) {
2121
genDoc := types.GenesisDoc{
22-
ChainID: Fmt("test-chain-%v", RandStr(6)),
22+
ChainID: cmn.Fmt("test-chain-%v", cmn.RandStr(6)),
2323
}
2424
genDoc.Validators = []types.GenesisValidator{types.GenesisValidator{
2525
PubKey: privValidator.PubKey,

0 commit comments

Comments
 (0)