From a42dccee7753404bc69c3961a327cb39856631c5 Mon Sep 17 00:00:00 2001 From: faddat Date: Wed, 26 Oct 2022 09:04:39 +0000 Subject: [PATCH] gofumpt --- internal/api/callbacks.go | 7 ++++--- internal/api/iterator.go | 12 ++++++++---- internal/api/memory_test.go | 1 + lib_test.go | 6 ++++-- types/ibc.go | 6 ++++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/internal/api/callbacks.go b/internal/api/callbacks.go index 5651ea44b..294aa37a9 100644 --- a/internal/api/callbacks.go +++ b/internal/api/callbacks.go @@ -136,9 +136,10 @@ type DBState struct { } // use this to create C.Db in two steps, so the pointer lives as long as the calling stack -// state := buildDBState(kv, callID) -// db := buildDB(&state, &gasMeter) -// // then pass db into some FFI function +// +// state := buildDBState(kv, callID) +// db := buildDB(&state, &gasMeter) +// // then pass db into some FFI function func buildDBState(kv KVStore, callID uint64) DBState { return DBState{ Store: kv, diff --git a/internal/api/iterator.go b/internal/api/iterator.go index a394164bc..6e30d1824 100644 --- a/internal/api/iterator.go +++ b/internal/api/iterator.go @@ -11,12 +11,16 @@ import ( type frame []dbm.Iterator // iteratorFrames contains one frame for each contract call, indexed by contract call ID. -var iteratorFrames = make(map[uint64]frame) -var iteratorFramesMutex sync.Mutex +var ( + iteratorFrames = make(map[uint64]frame) + iteratorFramesMutex sync.Mutex +) // this is a global counter for creating call IDs -var latestCallID uint64 -var latestCallIDMutex sync.Mutex +var ( + latestCallID uint64 + latestCallIDMutex sync.Mutex +) // startCall is called at the beginning of a contract call to create a new frame in iteratorFrames. // It updates latestCallID for generating a new call ID. diff --git a/internal/api/memory_test.go b/internal/api/memory_test.go index b05b94fdf..e1dcbfaac 100644 --- a/internal/api/memory_test.go +++ b/internal/api/memory_test.go @@ -58,6 +58,7 @@ func TestCreateAndDestroyUnmanagedVector(t *testing.T) { // Like the test above but without `newUnmanagedVector` calls. // Since only Rust can actually create them, we only test edge cases here. +// //go:nocheckptr func TestCopyDestroyUnmanagedVector(t *testing.T) { { diff --git a/lib_test.go b/lib_test.go index b6c087b77..76a3d8161 100644 --- a/lib_test.go +++ b/lib_test.go @@ -20,8 +20,10 @@ const ( TESTING_CACHE_SIZE = 100 // MiB ) -const CYBERPUNK_TEST_CONTRACT = "./testdata/cyberpunk.wasm" -const HACKATOM_TEST_CONTRACT = "./testdata/hackatom.wasm" +const ( + CYBERPUNK_TEST_CONTRACT = "./testdata/cyberpunk.wasm" + HACKATOM_TEST_CONTRACT = "./testdata/hackatom.wasm" +) func withVM(t *testing.T) *VM { tmpdir, err := ioutil.TempDir("", "wasmvm-testing") diff --git a/types/ibc.go b/types/ibc.go index 47b7745c3..6fc412f17 100644 --- a/types/ibc.go +++ b/types/ibc.go @@ -154,8 +154,10 @@ type IBCPacketTimeoutMsg struct { type IBCOrder = string // These are the only two valid values for IbcOrder -const Unordered = "ORDER_UNORDERED" -const Ordered = "ORDER_ORDERED" +const ( + Unordered = "ORDER_UNORDERED" + Ordered = "ORDER_ORDERED" +) // IBCTimeoutBlock Height is a monotonically increasing data type // that can be compared against another Height for the purposes of updating and