From 93acc5e934a82fef4d6c7d43820265d46fe11527 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 12:23:47 -0700 Subject: [PATCH 01/13] Turn module mode on --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 89651aeb1..d61ac6909 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ go: - stable go_import_path: github.com/harmony-one/harmony install: - - env GO111MODULE=on + - export GO111MODULE=on - export GOPATH=$HOME/gopath - export CGO_CPPFLAGS="-I$GOPATH/src/github.com/harmony-one/bls/include -I$GOPATH/src/github.com/harmony-one/mcl/include" - export CGO_LDFLAGS="-L$GOPATH/src/github.com/harmony-one/bls/lib -L$GOPATH/src/github.com/harmony-one/mcl/lib" From fe9c55c94c4c1e03b48ae5898793d10146bab7d7 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 12:27:32 -0700 Subject: [PATCH 02/13] Unvendor now that module mode is on --- .gitmodules | 7 ------- vendor/github.com/ethereum/go-ethereum | 1 - vendor/github.com/libp2p/go-libp2p-kad-dht | 1 - 3 files changed, 9 deletions(-) delete mode 160000 vendor/github.com/ethereum/go-ethereum delete mode 160000 vendor/github.com/libp2p/go-libp2p-kad-dht diff --git a/.gitmodules b/.gitmodules index ad2702ed2..e69de29bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +0,0 @@ -[submodule "vendor/github.com/ethereum/go-ethereum"] - path = vendor/github.com/ethereum/go-ethereum - url = https://github.com/harmony-one/go-ethereum - branch = master -[submodule "vendor/github.com/libp2p/go-libp2p-kad-dht"] - path = vendor/github.com/libp2p/go-libp2p-kad-dht - url = https://github.com/libp2p/go-libp2p-kad-dht diff --git a/vendor/github.com/ethereum/go-ethereum b/vendor/github.com/ethereum/go-ethereum deleted file mode 160000 index 38cce9ac3..000000000 --- a/vendor/github.com/ethereum/go-ethereum +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 38cce9ac333d674616047be14c270d7cfbd43641 diff --git a/vendor/github.com/libp2p/go-libp2p-kad-dht b/vendor/github.com/libp2p/go-libp2p-kad-dht deleted file mode 160000 index 838d43da0..000000000 --- a/vendor/github.com/libp2p/go-libp2p-kad-dht +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 838d43da02fc33899794e1c63fe4bd4d0bfd749a From 7714bae1a1b447028cd2a2a8ccd4dd3daf7f60d4 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 12:32:53 -0700 Subject: [PATCH 03/13] =?UTF-8?q?go-datastore=20v3.2.0=20=E2=86=92=20v0.0.?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v3.2.0 is now prefixed with gx/. --- go.mod | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 2a9eb8936..657b966cb 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/gorilla/mux v1.7.0 github.com/harmony-one/bls v0.0.1 github.com/hashicorp/golang-lru v0.5.1 - github.com/ipfs/go-datastore v3.2.0+incompatible + github.com/ipfs/go-datastore v0.0.1 github.com/libp2p/go-libp2p v0.0.2 github.com/libp2p/go-libp2p-crypto v0.0.1 github.com/libp2p/go-libp2p-discovery v0.0.1 @@ -31,5 +31,4 @@ require ( github.com/shirou/gopsutil v2.18.12+incompatible golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 google.golang.org/grpc v1.19.0 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) From 937b372cd9743e3a1909c883aaf1380b626f4877 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 12:37:31 -0700 Subject: [PATCH 04/13] go mod tidy --- go.mod | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/go.mod b/go.mod index 657b966cb..49c78b5d2 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,16 @@ module github.com/harmony-one/harmony go 1.12 require ( + github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 // indirect github.com/Workiva/go-datastructures v1.0.50 github.com/allegro/bigcache v1.2.0 // indirect github.com/aristanetworks/goarista v0.0.0-20190308231643-e9fb69a13f45 // indirect + github.com/cespare/cp v1.1.1 // indirect github.com/deckarep/golang-set v1.7.1 // indirect + github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/ethereum/go-ethereum v1.8.23 + github.com/fjl/memsize v0.0.0-20180929194037-2a09253e352a // indirect + github.com/go-ole/go-ole v1.2.4 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/golang/mock v1.2.0 github.com/golang/protobuf v1.3.0 @@ -15,6 +20,8 @@ require ( github.com/harmony-one/bls v0.0.1 github.com/hashicorp/golang-lru v0.5.1 github.com/ipfs/go-datastore v0.0.1 + github.com/ipfs/go-log v0.0.1 + github.com/karalabe/hid v0.0.0-20181128192157-d815e0c1a2e2 // indirect github.com/libp2p/go-libp2p v0.0.2 github.com/libp2p/go-libp2p-crypto v0.0.1 github.com/libp2p/go-libp2p-discovery v0.0.1 @@ -28,7 +35,14 @@ require ( github.com/multiformats/go-multiaddr-net v0.0.1 github.com/pborman/uuid v1.2.0 // indirect github.com/rjeczalik/notify v0.9.2 // indirect + github.com/rs/cors v1.6.0 // indirect github.com/shirou/gopsutil v2.18.12+incompatible + github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect + github.com/stretchr/testify v1.3.0 + github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 google.golang.org/grpc v1.19.0 + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 + gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + gopkg.in/urfave/cli.v1 v1.20.0 // indirect ) From 5d99b22d30dd27d763915dafc25eeaae9cd6dcd9 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 12:54:14 -0700 Subject: [PATCH 05/13] Make go generate verbose --- scripts/gogenerate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gogenerate.sh b/scripts/gogenerate.sh index 5ac4c3ebd..9adb847d0 100755 --- a/scripts/gogenerate.sh +++ b/scripts/gogenerate.sh @@ -6,4 +6,4 @@ case "${0}" in *) progdir=.;; esac git grep -l '^//go:generate ' -- '*.go' | \ - "${progdir}/xargs_by_dir.sh" go generate + "${progdir}/xargs_by_dir.sh" go generate -v -x From 36e794564a2c26dfcfa79a2b5e164b6cf5c69b86 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 12:56:53 -0700 Subject: [PATCH 06/13] Move go test to the end because it takes longest --- scripts/travis_checker.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/travis_checker.sh b/scripts/travis_checker.sh index d4702bd45..245a2f89c 100755 --- a/scripts/travis_checker.sh +++ b/scripts/travis_checker.sh @@ -16,15 +16,6 @@ tmpdir=$(mktemp -d) . "${progdir}/setup_bls_build_flags.sh" -echo "Running go test..." -if go test -v -count=1 ./... -then - echo "go test succeeded." -else - echo "go test FAILED!" - ok=false -fi - echo "Running golint..." golint_output="${tmpdir}/golint_output.txt" if "${progdir}/golint.sh" -set_exit_status > "${golint_output}" 2>&1 @@ -74,6 +65,15 @@ else ok=false fi +echo "Running go test..." +if go test -v -count=1 ./... +then + echo "go test succeeded." +else + echo "go test FAILED!" + ok=false +fi + if ! ${ok} then echo "Some checks failed; see output above." From bf662ff159efd906162055f614d4040f04cc777d Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 13:02:54 -0700 Subject: [PATCH 07/13] Check if go.mod dependencies have changed This is to see if manual tool installation upgraded any dependencies. --- scripts/travis_checker.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/travis_checker.sh b/scripts/travis_checker.sh index 245a2f89c..792570d80 100755 --- a/scripts/travis_checker.sh +++ b/scripts/travis_checker.sh @@ -1,6 +1,6 @@ #!/bin/bash -unset -v ok tmpdir goimports_output golint_output progdir +unset -v ok tmpdir gomod_diff_output goimports_output golint_output progdir ok=true case "${0}" in @@ -16,6 +16,19 @@ tmpdir=$(mktemp -d) . "${progdir}/setup_bls_build_flags.sh" +echo "Checking go.mod..." +gomod_diff_output="${tmpdir}/gomod.diff" +if git diff --exit-code -- go.mod > "${gomod_diff_output}" +then + echo "go.mod stayed the same as in the repository." +else + echo "go.mod has changed from the repository version!" + "${progdir}/print_file.sh" "${gomod_diff_output}" "go.mod diff" + "${progdir}/print_file.sh" go.mod "go.mod changed contents" + #ok=false + echo "Not treating this as an error, but consider updating go.mod!" +fi + echo "Running golint..." golint_output="${tmpdir}/golint_output.txt" if "${progdir}/golint.sh" -set_exit_status > "${golint_output}" 2>&1 From b64d7a44121a51468e606deba59b935e4c1f78e7 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 13:07:05 -0700 Subject: [PATCH 08/13] =?UTF-8?q?=E2=80=9Cgo=20get:=20-t=20flag=20is=20a?= =?UTF-8?q?=20no-op=20when=20using=20modules=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d61ac6909..e660ee286 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ install: - cd bls - make - cd ../harmony - - go get -t -v ./... + - go get -v ./... - go get -u golang.org/x/lint/golint - go get -u golang.org/x/tools/cmd/goimports - go get gopkg.in/check.v1 From da3c93fb58371b5355923ede044ab0ad398d15e6 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 13:11:59 -0700 Subject: [PATCH 09/13] Temporarily disable gencodec gencodec fails spectacularly and colorfully in various places; see https://travis-ci.org/harmony-ek/harmony/builds/507288316 for one. Local builds run into a bunch of other issues as well. --- core/genesis.go | 4 ++-- core/types/log.go | 2 +- core/types/receipt.go | 2 +- core/types/transaction.go | 2 +- core/vm/logger.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/genesis.go b/core/genesis.go index 65aade753..7527cec6e 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -37,8 +37,8 @@ import ( "github.com/harmony-one/harmony/internal/utils" ) -//go:generate gencodec -type Genesis -field-override genesisSpecMarshaling -out gen_genesis.go -//go:generate gencodec -type GenesisAccount -field-override genesisAccountMarshaling -out gen_genesis_account.go +// no go:generate gencodec -type Genesis -field-override genesisSpecMarshaling -out gen_genesis.go +// no go:generate gencodec -type GenesisAccount -field-override genesisAccountMarshaling -out gen_genesis_account.go var errGenesisNoConfig = errors.New("genesis has no chain configuration") diff --git a/core/types/log.go b/core/types/log.go index 717cd2e5a..6142a1656 100644 --- a/core/types/log.go +++ b/core/types/log.go @@ -24,7 +24,7 @@ import ( "github.com/ethereum/go-ethereum/rlp" ) -//go:generate gencodec -type Log -field-override logMarshaling -out gen_log_json.go +// no go:generate gencodec -type Log -field-override logMarshaling -out gen_log_json.go // Log represents a contract log event. These events are generated by the LOG opcode and // stored/indexed by the node. diff --git a/core/types/receipt.go b/core/types/receipt.go index 3d1fc95aa..aee69a66f 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -27,7 +27,7 @@ import ( "github.com/ethereum/go-ethereum/rlp" ) -//go:generate gencodec -type Receipt -field-override receiptMarshaling -out gen_receipt_json.go +// no go:generate gencodec -type Receipt -field-override receiptMarshaling -out gen_receipt_json.go var ( receiptStatusFailedRLP = []byte{} diff --git a/core/types/transaction.go b/core/types/transaction.go index e220abfca..e7bf4174c 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/rlp" ) -//go:generate gencodec -type txdata -field-override txdataMarshaling -out gen_tx_json.go +// no go:generate gencodec -type txdata -field-override txdataMarshaling -out gen_tx_json.go // Errors constants for Transaction. var ( diff --git a/core/vm/logger.go b/core/vm/logger.go index 1733bf270..ebeea4c53 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -51,7 +51,7 @@ type LogConfig struct { Limit int // maximum length of output, but zero means unlimited } -//go:generate gencodec -type StructLog -field-override structLogMarshaling -out gen_structlog.go +// no go:generate gencodec -type StructLog -field-override structLogMarshaling -out gen_structlog.go // StructLog is emitted to the EVM each cycle and lists information about the current internal state // prior to the execution of the statement. From 9d6ea5f13721e7ca64d05d19c1890d4059f81718 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 13:25:27 -0700 Subject: [PATCH 10/13] Move go build -v ./... to the script stage Install stage (where it was previously found), by convention, is used for installing tools and dependencies only. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e660ee286..a874c41de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,8 +28,8 @@ install: - go get github.com/golang/protobuf/protoc-gen-go - ./scripts/install_protoc.sh -V 3.6.1 - ./scripts/travis_checker.sh - - go build -v ./... script: + - go build -v ./... - ./scripts/travis_checker.sh notifications: slack: harmonyone:gggCd1QQopsQAW8JYgBWiH7M From e3bd479aa4d2272ae85d0812a3fbbfd7ab87c3c0 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 13:26:52 -0700 Subject: [PATCH 11/13] Do not run Travis checker twice Really. Makes no sense to do so. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a874c41de..a9380b7ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,6 @@ install: - go get github.com/golang/mock/mockgen - go get github.com/golang/protobuf/protoc-gen-go - ./scripts/install_protoc.sh -V 3.6.1 - - ./scripts/travis_checker.sh script: - go build -v ./... - ./scripts/travis_checker.sh From 31be7f063244ca81481591aecc3b54939ad6243b Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 15:14:18 -0700 Subject: [PATCH 12/13] Make go build verbose --- scripts/go_executable_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/go_executable_build.sh b/scripts/go_executable_build.sh index d4bc031ad..ffe2d076c 100755 --- a/scripts/go_executable_build.sh +++ b/scripts/go_executable_build.sh @@ -89,7 +89,7 @@ function build_only if [[ -z "$build" || "$bin" == "$build" ]]; then rm -f $BINDIR/$bin echo "building ${SRC[$bin]}" - env GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]} + env GOOS=$GOOS GOARCH=$GOARCH go build -v -x -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]} if [ "$(uname -s)" == "Linux" ]; then $BINDIR/$bin -version fi From a6ed72800bcd3552432ad8eb21667b6f40c9cbdc Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sat, 16 Mar 2019 15:06:12 -0700 Subject: [PATCH 13/13] GO111MODULE does not belong here; remove --- scripts/go_executable_build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/go_executable_build.sh b/scripts/go_executable_build.sh index ffe2d076c..e2fb4fba4 100755 --- a/scripts/go_executable_build.sh +++ b/scripts/go_executable_build.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -export GO111MODULE=on - declare -A SRC SRC[harmony]=cmd/harmony/main.go SRC[txgen]=cmd/client/txgen/main.go