From 0b9d8d251814da159e50516e9e712049313178ed Mon Sep 17 00:00:00 2001 From: hackyminer Date: Tue, 26 Jun 2018 22:04:27 +0900 Subject: [PATCH 1/2] build: make build/goimports.sh more potable --- build/goimports.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/build/goimports.sh b/build/goimports.sh index 6d67ef1f0f..1fcace6a4b 100755 --- a/build/goimports.sh +++ b/build/goimports.sh @@ -1,18 +1,18 @@ -#!/usr/bin/env bash +#!/bin/sh find_files() { - find . -not \( \ + find . ! \( \ \( \ - -wholename '.github' \ - -o -wholename './build/_workspace' \ - -o -wholename './build/bin' \ - -o -wholename './crypto/bn256' \ - -o -wholename '*/vendor/*' \ + -path '.github' \ + -o -path './build/_workspace' \ + -o -path './build/bin' \ + -o -path './crypto/bn256' \ + -o -path '*/vendor/*' \ \) -prune \ \) -name '*.go' } -GOFMT="gofmt -s -w"; -GOIMPORTS="goimports -w"; -find_files | xargs $GOFMT; -find_files | xargs $GOIMPORTS; \ No newline at end of file +GOFMT="gofmt -s -w" +GOIMPORTS="goimports -w" +find_files | xargs $GOFMT +find_files | xargs $GOIMPORTS From 5be1099770a131f5bd35c377229b6ae2df20a0ae Mon Sep 17 00:00:00 2001 From: sf Date: Thu, 28 Jun 2018 20:15:39 +0800 Subject: [PATCH 2/2] accounts/abi: fix method overwritten by same name methods --- accounts/abi/abi.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go index 254b1f7fb4..a2e07af0e2 100644 --- a/accounts/abi/abi.go +++ b/accounts/abi/abi.go @@ -21,6 +21,7 @@ import ( "encoding/json" "fmt" "io" + "strconv" ) // The ABI holds information about a contract's context and available @@ -108,6 +109,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error { abi.Methods = make(map[string]Method) abi.Events = make(map[string]Event) + functionCnt, eventCnt := 0, 0 for _, field := range fields { switch field.Type { case "constructor": @@ -122,12 +124,16 @@ func (abi *ABI) UnmarshalJSON(data []byte) error { Inputs: field.Inputs, Outputs: field.Outputs, } + abi.Methods[field.Name+strconv.Itoa(functionCnt)] = abi.Methods[field.Name] + functionCnt++ case "event": abi.Events[field.Name] = Event{ Name: field.Name, Anonymous: field.Anonymous, Inputs: field.Inputs, } + abi.Events[field.Name+strconv.Itoa(eventCnt)] = abi.Events[field.Name] + eventCnt++ } }