From c7414be0645a03f050abf8f17a9b0ea3fc58b3d2 Mon Sep 17 00:00:00 2001 From: moul <94029+moul@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:07:52 +0100 Subject: [PATCH] chore: fmt Signed-off-by: moul <94029+moul@users.noreply.github.com> --- .github/workflows/build_template.yml | 3 ++- gno.land/Makefile | 6 +++++- gnovm/Makefile | 2 +- gnovm/pkg/gnolang/internal/softfloat/copy.sh | 6 +++--- .../internal/softfloat/runtime_softfloat64_test.go | 5 +++-- tm2/Makefile | 5 +++++ tm2/pkg/overflow/overflow_impl.go | 12 ++++-------- 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_template.yml b/.github/workflows/build_template.yml index a2c96f2d37e..454e76b84da 100644 --- a/.github/workflows/build_template.yml +++ b/.github/workflows/build_template.yml @@ -23,7 +23,8 @@ jobs: - name: Check generated files are up to date working-directory: ${{ inputs.modulepath }} run: | - go generate -x ./... + make generate + if [ "$(git status -s)" != "" ]; then echo "command 'go generate' creates file that differ from git tree, please run 'go generate' and commit:" git status -s diff --git a/gno.land/Makefile b/gno.land/Makefile index 075560f44a9..90ba7451c35 100644 --- a/gno.land/Makefile +++ b/gno.land/Makefile @@ -50,9 +50,13 @@ install.gnokey:; go install ./cmd/gnokey .PHONY: dev.gnoweb generate.gnoweb dev.gnoweb: make -C ./pkg/gnoweb dev -generate.gnoweb: + +.PHONY: generate +generate: + go generate -x ./... make -C ./pkg/gnoweb generate + .PHONY: fclean fclean: clean rm -rf gnoland-data genesis.json diff --git a/gnovm/Makefile b/gnovm/Makefile index babb7ad74ca..d02b99045c7 100644 --- a/gnovm/Makefile +++ b/gnovm/Makefile @@ -125,7 +125,7 @@ _test.filetest:; # TODO: move _dev.stringer to go:generate instructions, simplify generate # to just go generate. .PHONY: generate -generate: _dev.stringer _dev.generate +generate: _dev.stringer _dev.generate fmt imports stringer_cmd=$(rundep) golang.org/x/tools/cmd/stringer .PHONY: _dev.stringer diff --git a/gnovm/pkg/gnolang/internal/softfloat/copy.sh b/gnovm/pkg/gnolang/internal/softfloat/copy.sh index 6d2a8f80462..d46623117e8 100644 --- a/gnovm/pkg/gnolang/internal/softfloat/copy.sh +++ b/gnovm/pkg/gnolang/internal/softfloat/copy.sh @@ -10,7 +10,7 @@ cat > runtime_softfloat64.go << EOF EOF cat "$GOROOT/src/runtime/softfloat64.go" >> ./runtime_softfloat64.go -sed -i 's/^package runtime$/package softfloat/' runtime_softfloat64.go +sed -i '' 's/^package runtime$/package softfloat/' runtime_softfloat64.go # softfloat64_test.go: # - add header @@ -25,8 +25,8 @@ cat > runtime_softfloat64_test.go << EOF EOF cat "$GOROOT/src/runtime/softfloat64_test.go" >> ./runtime_softfloat64_test.go -sed -i 's/^package runtime_test$/package softfloat_test/ +sed -i '' 's/^package runtime_test$/package softfloat_test/ s#^\t\. "runtime"$#\t. "github.com/gnolang/gno/gnovm/pkg/gnolang/internal/softfloat"# s/GOARCH/runtime.GOARCH/g 16a\ - "runtime"' runtime_softfloat64_test.go \ No newline at end of file + "runtime"' runtime_softfloat64_test.go diff --git a/gnovm/pkg/gnolang/internal/softfloat/runtime_softfloat64_test.go b/gnovm/pkg/gnolang/internal/softfloat/runtime_softfloat64_test.go index c57fe08b0ef..7b3a40ab838 100644 --- a/gnovm/pkg/gnolang/internal/softfloat/runtime_softfloat64_test.go +++ b/gnovm/pkg/gnolang/internal/softfloat/runtime_softfloat64_test.go @@ -12,9 +12,10 @@ package softfloat_test import ( "math" "math/rand" - . "github.com/gnolang/gno/gnovm/pkg/gnolang/internal/softfloat" + "runtime" "testing" - "runtime" + + . "github.com/gnolang/gno/gnovm/pkg/gnolang/internal/softfloat" ) // turn uint64 op into float64 op diff --git a/tm2/Makefile b/tm2/Makefile index 0aaa63e5285..fd3aede0d4c 100644 --- a/tm2/Makefile +++ b/tm2/Makefile @@ -63,3 +63,8 @@ _test.pkg.others:; go test $(GOTEST_FLAGS) `go list ./pkg/... | grep -Ev 'pkg/( _test.pkg.amino:; go test $(GOTEST_FLAGS) ./pkg/amino/... _test.pkg.bft:; go test $(GOTEST_FLAGS) ./pkg/bft/... _test.pkg.db:; go test $(GOTEST_FLAGS) ./pkg/db/... ./pkg/iavl/benchmarks/... + +.PHONY: generate +generate: + go generate -x ./... + $(MAKE) fmt diff --git a/tm2/pkg/overflow/overflow_impl.go b/tm2/pkg/overflow/overflow_impl.go index 0f057f65387..ab9f13c163d 100644 --- a/tm2/pkg/overflow/overflow_impl.go +++ b/tm2/pkg/overflow/overflow_impl.go @@ -84,10 +84,9 @@ func Quotient8(a, b int8) (int8, int8, bool) { } c := a / b status := (c < 0) == ((a < 0) != (b < 0)) || (c == 0) // no sign check for 0 quotient - return c, a%b, status + return c, a % b, status } - // Add16 performs + operation on two int16 operands, returning a result and status. func Add16(a, b int16) (int16, bool) { c := a + b @@ -170,10 +169,9 @@ func Quotient16(a, b int16) (int16, int16, bool) { } c := a / b status := (c < 0) == ((a < 0) != (b < 0)) || (c == 0) // no sign check for 0 quotient - return c, a%b, status + return c, a % b, status } - // Add32 performs + operation on two int32 operands, returning a result and status. func Add32(a, b int32) (int32, bool) { c := a + b @@ -256,10 +254,9 @@ func Quotient32(a, b int32) (int32, int32, bool) { } c := a / b status := (c < 0) == ((a < 0) != (b < 0)) || (c == 0) // no sign check for 0 quotient - return c, a%b, status + return c, a % b, status } - // Add64 performs + operation on two int64 operands, returning a result and status. func Add64(a, b int64) (int64, bool) { c := a + b @@ -342,6 +339,5 @@ func Quotient64(a, b int64) (int64, int64, bool) { } c := a / b status := (c < 0) == ((a < 0) != (b < 0)) || (c == 0) // no sign check for 0 quotient - return c, a%b, status + return c, a % b, status } -