From ba5fcc4ad8b104902dc9781f040f96e25061797e Mon Sep 17 00:00:00 2001 From: tbjump Date: Wed, 1 Jun 2022 16:16:31 +0000 Subject: [PATCH] apply gofmt and enforce it for new commits --- .github/workflows/build.yml | 3 +++ algorand/sandbox-algorand/images/indexer/disabled.go | 4 +--- node/pkg/celo/abi/abi.go | 1 - node/pkg/vaa/governance_test.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6d9726f9..6cf8934f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,6 +85,9 @@ jobs: - uses: actions/setup-go@v2 with: go-version: "1.17.5" + # ensure that code is formatted + - run: GOFMT_OUTPUT="$(gofmt -l `find ./node ./event_database -name '*.go' | grep -v vendor` 2>&1)"; [ -n "$GOFMT_OUTPUT" ] && printf "All the following files are not correctly formatted\n${GOFMT_OUTPUT}\n" && exit 1" + # run linters - run: make generate && ./lint.sh # The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols. - run: cd node && go test -v -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./... diff --git a/algorand/sandbox-algorand/images/indexer/disabled.go b/algorand/sandbox-algorand/images/indexer/disabled.go index 7a9e033ba..d6a677458 100644 --- a/algorand/sandbox-algorand/images/indexer/disabled.go +++ b/algorand/sandbox-algorand/images/indexer/disabled.go @@ -7,7 +7,6 @@ import ( "os" ) - func main() { var port int var code int @@ -19,12 +18,11 @@ func main() { flag.Parse() - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request){ + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(code) fmt.Fprintf(w, "%s\n", message) }) - fmt.Printf("Starting server at port %d\nResponse code (%d)\nmessage (%s)\n", port, code, message) if err := http.ListenAndServe(fmt.Sprintf(":%d", port), nil); err != nil { fmt.Fprintf(os.Stderr, err.Error()) diff --git a/node/pkg/celo/abi/abi.go b/node/pkg/celo/abi/abi.go index 718f5edd0..7c5f86996 100644 --- a/node/pkg/celo/abi/abi.go +++ b/node/pkg/celo/abi/abi.go @@ -1898,4 +1898,3 @@ func (_Abi *AbiFilterer) ParseUpgraded(log types.Log) (*AbiUpgraded, error) { event.Raw = log return event, nil } - diff --git a/node/pkg/vaa/governance_test.go b/node/pkg/vaa/governance_test.go index 5699ef996..4ec3a73b4 100644 --- a/node/pkg/vaa/governance_test.go +++ b/node/pkg/vaa/governance_test.go @@ -14,7 +14,7 @@ func TestCreateGovernanceVAA(t *testing.T) { var governanceEmitter = Address{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4} got_vaa := CreateGovernanceVAA(timestamp, nonce, sequence, guardianSetIndex, payload) - + want_vaa := &VAA{ Version: uint8(1), GuardianSetIndex: uint32(1),