Skip to content

Commit 57bfb87

Browse files
authored
Merge pull request ethereum#34 from etclabscore/go-modules
Add go modules support.
2 parents 89d5172 + 4ef1235 commit 57bfb87

File tree

1,527 files changed

+602
-809259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,527 files changed

+602
-809259
lines changed

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
linters-settings:
2+
goconst:
3+
min-occurrences: 6

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ matrix:
55
include:
66
- os: linux
77
dist: xenial
8-
go: 1.12.x
8+
go: 1.13.x
99
script:
1010
- go run build/ci.go install
1111
- travis_wait 60 go run build/ci.go test
@@ -24,7 +24,7 @@ matrix:
2424
skip_cleanup: true
2525
tag_name: "$TRAVIS_TAG"
2626
- os: osx
27-
go: 1.12.x
27+
go: 1.13.x
2828
script:
2929
- echo "Increase the maximum number of open file descriptors on macOS"
3030
- NOFILE=20480
@@ -52,10 +52,10 @@ matrix:
5252
tag_name: "$TRAVIS_TAG"
5353
- os: linux
5454
dist: xenial
55-
go: 1.12.x
55+
go: 1.13.x
5656
env:
5757
- lint
5858
git:
5959
submodules: false
6060
script:
61-
- go run build/ci.go lint
61+
- go run build/ci.go lint

Makefile

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# with Go source code. If you know what GOPATH is then you probably
33
# don't need to bother with make.
44

5-
.PHONY: geth android ios geth-cross evm all test clean
5+
.PHONY: geth android ios geth-cross swarm evm all test clean
66
.PHONY: geth-linux geth-linux-386 geth-linux-amd64 geth-linux-mips64 geth-linux-mips64le
77
.PHONY: geth-linux-arm geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
88
.PHONY: geth-darwin geth-darwin-386 geth-darwin-amd64
@@ -12,32 +12,37 @@ GOBIN = $(shell pwd)/build/bin
1212
GO ?= latest
1313

1414
geth:
15-
build/env.sh go run build/ci.go install ./cmd/geth
15+
go run build/ci.go install ./cmd/geth
1616
@echo "Done building."
1717
@echo "Run \"$(GOBIN)/geth\" to launch geth."
1818

19+
swarm:
20+
go run build/ci.go install ./cmd/swarm
21+
@echo "Done building."
22+
@echo "Run \"$(GOBIN)/swarm\" to launch swarm."
23+
1924
all:
20-
build/env.sh go run build/ci.go install
25+
go run build/ci.go install
2126

2227
android:
23-
build/env.sh go run build/ci.go aar --local
28+
go run build/ci.go aar --local
2429
@echo "Done building."
2530
@echo "Import \"$(GOBIN)/geth.aar\" to use the library."
2631

2732
ios:
28-
build/env.sh go run build/ci.go xcode --local
33+
go run build/ci.go xcode --local
2934
@echo "Done building."
3035
@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
3136

3237
test: all
33-
build/env.sh go run build/ci.go test
38+
go run build/ci.go test
3439

3540
lint: ## Run linters.
36-
build/env.sh go run build/ci.go lint
41+
go run build/ci.go lint
3742

3843
clean:
3944
./build/clean_go_build_cache.sh
40-
rm -fr build/_workspace/pkg/ $(GOBIN)/*
45+
rm -fr $(GOBIN)/*
4146

4247
# The devtools target installs tools required for 'go generate'.
4348
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
@@ -63,12 +68,12 @@ geth-linux: geth-linux-386 geth-linux-amd64 geth-linux-arm geth-linux-mips64 get
6368
@ls -ld $(GOBIN)/geth-linux-*
6469

6570
geth-linux-386:
66-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/geth
71+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/geth
6772
@echo "Linux 386 cross compilation done:"
6873
@ls -ld $(GOBIN)/geth-linux-* | grep 386
6974

7075
geth-linux-amd64:
71-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/geth
76+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/geth
7277
@echo "Linux amd64 cross compilation done:"
7378
@ls -ld $(GOBIN)/geth-linux-* | grep amd64
7479

@@ -77,42 +82,42 @@ geth-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-ar
7782
@ls -ld $(GOBIN)/geth-linux-* | grep arm
7883

7984
geth-linux-arm-5:
80-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/geth
85+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/geth
8186
@echo "Linux ARMv5 cross compilation done:"
8287
@ls -ld $(GOBIN)/geth-linux-* | grep arm-5
8388

8489
geth-linux-arm-6:
85-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/geth
90+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/geth
8691
@echo "Linux ARMv6 cross compilation done:"
8792
@ls -ld $(GOBIN)/geth-linux-* | grep arm-6
8893

8994
geth-linux-arm-7:
90-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/geth
95+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/geth
9196
@echo "Linux ARMv7 cross compilation done:"
9297
@ls -ld $(GOBIN)/geth-linux-* | grep arm-7
9398

9499
geth-linux-arm64:
95-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/geth
100+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/geth
96101
@echo "Linux ARM64 cross compilation done:"
97102
@ls -ld $(GOBIN)/geth-linux-* | grep arm64
98103

99104
geth-linux-mips:
100-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/geth
105+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/geth
101106
@echo "Linux MIPS cross compilation done:"
102107
@ls -ld $(GOBIN)/geth-linux-* | grep mips
103108

104109
geth-linux-mipsle:
105-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/geth
110+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/geth
106111
@echo "Linux MIPSle cross compilation done:"
107112
@ls -ld $(GOBIN)/geth-linux-* | grep mipsle
108113

109114
geth-linux-mips64:
110-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/geth
115+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/geth
111116
@echo "Linux MIPS64 cross compilation done:"
112117
@ls -ld $(GOBIN)/geth-linux-* | grep mips64
113118

114119
geth-linux-mips64le:
115-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/geth
120+
go run build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/geth
116121
@echo "Linux MIPS64le cross compilation done:"
117122
@ls -ld $(GOBIN)/geth-linux-* | grep mips64le
118123

@@ -121,12 +126,12 @@ geth-darwin: geth-darwin-386 geth-darwin-amd64
121126
@ls -ld $(GOBIN)/geth-darwin-*
122127

123128
geth-darwin-386:
124-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/geth
129+
go run build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/geth
125130
@echo "Darwin 386 cross compilation done:"
126131
@ls -ld $(GOBIN)/geth-darwin-* | grep 386
127132

128133
geth-darwin-amd64:
129-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/geth
134+
go run build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/geth
130135
@echo "Darwin amd64 cross compilation done:"
131136
@ls -ld $(GOBIN)/geth-darwin-* | grep amd64
132137

@@ -135,11 +140,11 @@ geth-windows: geth-windows-386 geth-windows-amd64
135140
@ls -ld $(GOBIN)/geth-windows-*
136141

137142
geth-windows-386:
138-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/geth
143+
go run build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/geth
139144
@echo "Windows 386 cross compilation done:"
140145
@ls -ld $(GOBIN)/geth-windows-* | grep 386
141146

142147
geth-windows-amd64:
143-
build/env.sh go run build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
148+
go run build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
144149
@echo "Windows amd64 cross compilation done:"
145150
@ls -ld $(GOBIN)/geth-windows-* | grep amd64

accounts/abi/bind/base.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,6 @@ func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]int
287287
return nil
288288
}), nil
289289

290-
if err != nil {
291-
return nil, nil, err
292-
}
293290
return logs, sub, nil
294291
}
295292

accounts/abi/bind/bind_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,17 +1384,13 @@ func TestGolangBindings(t *testing.T) {
13841384
if !common.FileExist(gocmd) {
13851385
t.Skip("go sdk not found for testing")
13861386
}
1387-
// Create a temporary workspace for the test suite
1388-
ws, err := ioutil.TempDir("", "")
1389-
if err != nil {
1390-
t.Fatalf("failed to create temporary workspace: %v", err)
1391-
}
1392-
defer os.RemoveAll(ws)
13931387

1394-
pkg := filepath.Join(ws, "bindtest")
1395-
if err = os.MkdirAll(pkg, 0700); err != nil {
1388+
pkg := "bindtest"
1389+
if err := os.MkdirAll(pkg, 0700); err != nil {
13961390
t.Fatalf("failed to create package: %v", err)
13971391
}
1392+
defer os.RemoveAll(pkg)
1393+
13981394
// Generate the test suite for all the contracts
13991395
for i, tt := range bindTests {
14001396
var types []string

accounts/scwallet/hub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (hub *Hub) setPairing(wallet *Wallet, pairing *smartcardPairing) error {
153153

154154
// NewHub creates a new hardware wallet manager for smartcards.
155155
func NewHub(daemonPath string, scheme string, datadir string) (*Hub, error) {
156-
context, err := pcsc.EstablishContext(daemonPath, pcsc.ScopeSystem)
156+
context, err := pcsc.EstablishContext(pcsc.ScopeSystem)
157157
if err != nil {
158158
return nil, err
159159
}

build/ci.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,21 +325,20 @@ func doTest(cmdline []string) {
325325
build.MustRun(gotest)
326326
}
327327

328-
// runs gometalinter on requested packages
328+
// runs golangci-lint on requested packages
329329
func doLint(cmdline []string) {
330330
flag.CommandLine.Parse(cmdline)
331331

332332
packages := []string{"./..."}
333333
if len(flag.CommandLine.Args()) > 0 {
334334
packages = flag.CommandLine.Args()
335335
}
336-
// Get metalinter and install all supported linters
337-
build.MustRun(goTool("get", "gopkg.in/alecthomas/gometalinter.v2"))
338-
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), "--install")
336+
// Get golangci-lint and install all supported linters
337+
build.MustRun(goTool("get", "github.com/golangci/golangci-lint/cmd/[email protected]"))
339338

340339
// Run fast linters batched together
341340
configs := []string{
342-
"--vendor",
341+
"run",
343342
"--tests",
344343
"--deadline=2m",
345344
"--disable-all",
@@ -349,14 +348,13 @@ func doLint(cmdline []string) {
349348
"--enable=gofmt",
350349
"--enable=misspell",
351350
"--enable=goconst",
352-
"--min-occurrences=6", // for goconst
353351
}
354-
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), append(configs, packages...)...)
352+
build.MustRunCommand(filepath.Join(GOBIN, "golangci-lint"), append(configs, packages...)...)
355353

356354
// Run slow linters one by one
357355
for _, linter := range []string{"unconvert", "gosimple"} {
358-
configs = []string{"--vendor", "--tests", "--deadline=10m", "--disable-all", "--enable=" + linter}
359-
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), append(configs, packages...)...)
356+
configs = []string{"run", "--tests", "--deadline=10m", "--disable-all", "--enable=" + linter}
357+
build.MustRunCommand(filepath.Join(GOBIN, "golangci-lint"), append(configs, packages...)...)
360358
}
361359
}
362360

build/env.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

build/goimports.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ find_files() {
44
find . ! \( \
55
\( \
66
-path '.github' \
7-
-o -path './build/_workspace' \
87
-o -path './build/bin' \
98
-o -path './crypto/bn256' \
109
-o -path '*/vendor/*' \

cmd/clef/main.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -744,21 +744,21 @@ func testExternalUI(api *core.SignerAPI) {
744744
api.UI.ShowInfo("Please approve the next request for signing a clique header")
745745
time.Sleep(delay)
746746
cliqueHeader := types.Header{
747-
common.HexToHash("0000H45H"),
748-
common.HexToHash("0000H45H"),
749-
common.HexToAddress("0000H45H"),
750-
common.HexToHash("0000H00H"),
751-
common.HexToHash("0000H45H"),
752-
common.HexToHash("0000H45H"),
753-
types.Bloom{},
754-
big.NewInt(1337),
755-
big.NewInt(1337),
756-
1338,
757-
1338,
758-
1338,
759-
[]byte("Extra data Extra data Extra data Extra data Extra data Extra data Extra data Extra data"),
760-
common.HexToHash("0x0000H45H"),
761-
types.BlockNonce{},
747+
ParentHash: common.HexToHash("0000H45H"),
748+
UncleHash: common.HexToHash("0000H45H"),
749+
Coinbase: common.HexToAddress("0000H45H"),
750+
Root: common.HexToHash("0000H00H"),
751+
TxHash: common.HexToHash("0000H45H"),
752+
ReceiptHash: common.HexToHash("0000H45H"),
753+
Bloom: types.Bloom{},
754+
Difficulty: big.NewInt(1337),
755+
Number: big.NewInt(1337),
756+
GasLimit: 1338,
757+
GasUsed: 1338,
758+
Time: 1338,
759+
Extra: []byte("Extra data Extra data Extra data Extra data Extra data Extra data Extra data Extra data"),
760+
MixDigest: common.HexToHash("0x0000H45H"),
761+
Nonce: types.BlockNonce{},
762762
}
763763
cliqueRlp, err := rlp.EncodeToBytes(cliqueHeader)
764764
if err != nil {
@@ -922,7 +922,7 @@ func GenDoc(ctx *cli.Context) {
922922
"of the work in canonicalizing and making sense of the data, and it's up to the UI to present" +
923923
"the user with the contents of the `message`"
924924
sighash, msg := accounts.TextAndHash([]byte("hello world"))
925-
messages := []*core.NameValueType{{"message", msg, accounts.MimetypeTextPlain}}
925+
messages := []*core.NameValueType{{Name: "message", Value: msg, Typ: accounts.MimetypeTextPlain}}
926926

927927
add("SignDataRequest", desc, &core.SignDataRequest{
928928
Address: common.NewMixedcaseAddress(a),
@@ -953,8 +953,8 @@ func GenDoc(ctx *cli.Context) {
953953
add("SignTxRequest", desc, &core.SignTxRequest{
954954
Meta: meta,
955955
Callinfo: []core.ValidationInfo{
956-
{"Warning", "Something looks odd, show this message as a warning"},
957-
{"Info", "User should see this aswell"},
956+
{Typ: "Warning", Message: "Something looks odd, show this message as a warning"},
957+
{Typ: "Info", Message: "User should see this aswell"},
958958
},
959959
Transaction: core.SendTxArgs{
960960
Data: &data,
@@ -1020,16 +1020,16 @@ func GenDoc(ctx *cli.Context) {
10201020
&core.ListRequest{
10211021
Meta: meta,
10221022
Accounts: []accounts.Account{
1023-
{a, accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/a"}},
1024-
{b, accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/b"}}},
1023+
{Address: a, URL: accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/a"}},
1024+
{Address: b, URL: accounts.URL{Scheme: "keystore", Path: "/path/to/keyfile/b"}}},
10251025
})
10261026

10271027
add("ListResponse", "Response to list request. The response contains a list of all addresses to show to the caller. "+
10281028
"Note: the UI is free to respond with any address the caller, regardless of whether it exists or not",
10291029
&core.ListResponse{
10301030
Accounts: []accounts.Account{
1031-
{common.HexToAddress("0xcowbeef000000cowbeef00000000000000000c0w"), accounts.URL{Path: ".. ignored .."}},
1032-
{common.HexToAddress("0xffffffffffffffffffffffffffffffffffffffff"), accounts.URL{}},
1031+
{Address: common.HexToAddress("0xcowbeef000000cowbeef00000000000000000c0w"), URL: accounts.URL{Path: ".. ignored .."}},
1032+
{Address: common.HexToAddress("0xffffffffffffffffffffffffffffffffffffffff"), URL: accounts.URL{}},
10331033
}})
10341034
}
10351035

0 commit comments

Comments
 (0)