Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running go vet on the project fails. #2954

Closed
mvertes opened this issue Oct 15, 2024 · 0 comments · Fixed by #3000
Closed

Running go vet on the project fails. #2954

mvertes opened this issue Oct 15, 2024 · 0 comments · Fixed by #3000
Assignees
Labels
🐞 bug Something isn't working in focus Core team is prioritizing this work 📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@mvertes
Copy link
Contributor

mvertes commented Oct 15, 2024

Description

$ go vet ./...
# github.com/gnolang/gno/tm2/pkg/db/memdb
tm2/pkg/db/memdb/mem_db.go:153:10: github.com/gnolang/gno/tm2/pkg/db/internal.MemBatch struct literal uses unkeyed fields
# github.com/gnolang/gno/gnovm/pkg/gnomod
# [github.com/gnolang/gno/gnovm/pkg/gnomod]
gnovm/pkg/gnomod/read.go:252:38: golang.org/x/mod/modfile.Comment struct literal uses unkeyed fields
# github.com/gnolang/gno/gno.land/pkg/sdk/vm
# [github.com/gnolang/gno/gno.land/pkg/sdk/vm]
gno.land/pkg/sdk/vm/builtins.go:45:59: github.com/gnolang/gno/tm2/pkg/std.Coin struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/builtins.go:53:64: github.com/gnolang/gno/tm2/pkg/std.Coin struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:84:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:129:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:183:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:227:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:271:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:315:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:366:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:405:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
gno.land/pkg/sdk/vm/keeper_test.go:477:3: *github.com/gnolang/gno/tm2/pkg/std.MemFile struct literal uses unkeyed fields
# github.com/gnolang/gno/gno.land/pkg/gnoweb
# [github.com/gnolang/gno/gno.land/pkg/gnoweb]
gno.land/pkg/gnoweb/gnoweb.go:479:41: slog.Logger.Error arg "err" should be a string or a slog.Attr (possible missing key or value)
# github.com/gnolang/gno/misc/logos/cmd
# [github.com/gnolang/gno/misc/logos/cmd]
misc/logos/cmd/logos.go:165:18: github.com/gnolang/gno/misc/logos.Padding struct literal uses unkeyed fields
# github.com/gnolang/gno/gnovm/tests
# [github.com/gnolang/gno/gnovm/tests]
gnovm/tests/file.go:600:29: github.com/gnolang/gno/tm2/pkg/std.Coin struct literal uses unkeyed fields
gnovm/tests/file.go:606:30: github.com/gnolang/gno/tm2/pkg/std.Coin struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/amino
# [github.com/gnolang/gno/tm2/pkg/amino]
tm2/pkg/amino/wellknown.go:242:8: assignment copies lock value to t: google.golang.org/protobuf/types/known/timestamppb.Timestamp contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
tm2/pkg/amino/wellknown.go:243:34: call of EncodeJSONPBTimestamp copies lock value: google.golang.org/protobuf/types/known/timestamppb.Timestamp contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
tm2/pkg/amino/wellknown.go:249:8: assignment copies lock value to d: google.golang.org/protobuf/types/known/durationpb.Duration contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
tm2/pkg/amino/wellknown.go:250:33: call of EncodeJSONPBDuration copies lock value: google.golang.org/protobuf/types/known/durationpb.Duration contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
tm2/pkg/amino/wellknown.go:304:26: call of reflect.ValueOf copies lock value: google.golang.org/protobuf/types/known/timestamppb.Timestamp contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
tm2/pkg/amino/wellknown.go:312:26: call of reflect.ValueOf copies lock value: google.golang.org/protobuf/types/known/durationpb.Duration contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
tm2/pkg/amino/wellknown.go:430:43: EncodeJSONPBTimestamp passes lock by value: google.golang.org/protobuf/types/known/timestamppb.Timestamp contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
tm2/pkg/amino/wellknown.go:460:42: EncodeJSONPBDuration passes lock by value: google.golang.org/protobuf/types/known/durationpb.Duration contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
tm2/pkg/amino/amino.go:759:19: method MarshalJSON(o interface{}) ([]byte, error) should have signature MarshalJSON() ([]byte, error)
tm2/pkg/amino/amino.go:833:19: method UnmarshalJSON(bz []byte, ptr interface{}) error should have signature UnmarshalJSON([]byte) error
tm2/pkg/amino/wellknown.go:213:2: unreachable code
# github.com/gnolang/gno/tm2/pkg/bft/abci/example/kvstore
# [github.com/gnolang/gno/tm2/pkg/bft/abci/example/kvstore]
tm2/pkg/bft/abci/example/kvstore/helpers.go:14:7: github.com/gnolang/gno/tm2/pkg/bft/abci/types.ValidatorUpdate struct literal uses unkeyed fields
tm2/pkg/bft/abci/example/kvstore/persistent_kvstore.go:214:29: github.com/gnolang/gno/tm2/pkg/bft/abci/types.ValidatorUpdate struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/bft/consensus
# [github.com/gnolang/gno/tm2/pkg/bft/consensus]
tm2/pkg/bft/consensus/state.go:76:10: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.HRS struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:749:21: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventTimeoutPropose struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:752:21: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventTimeoutWait struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:755:21: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventTimeoutWait struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:1129:20: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventPolka struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:1146:22: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventUnlock struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:1158:21: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventRelock struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:1173:21: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventLock struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:1189:20: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventUnlock struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:1594:20: github.com/gnolang/gno/tm2/pkg/bft/types.EventVote struct literal uses unkeyed fields
tm2/pkg/bft/consensus/state.go:1623:23: github.com/gnolang/gno/tm2/pkg/bft/consensus/types.EventUnlock struct literal uses unkeyed fields
tm2/pkg/bft/consensus/wal_generator.go:80:21: github.com/gnolang/gno/tm2/pkg/bft/wal.TimedWALMessage struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/bitarray
# [github.com/gnolang/gno/tm2/pkg/bitarray]
tm2/pkg/bitarray/bit_array.go:417:8: assignment copies lock value to *bA: github.com/gnolang/gno/tm2/pkg/bitarray.BitArray contains sync.Mutex
# github.com/gnolang/gno/tm2/pkg/bft/types
# [github.com/gnolang/gno/tm2/pkg/bft/types]
tm2/pkg/bft/types/params.go:38:9: github.com/gnolang/gno/tm2/pkg/bft/abci/types.ConsensusParams struct literal uses unkeyed fields
tm2/pkg/bft/types/params.go:54:10: github.com/gnolang/gno/tm2/pkg/bft/abci/types.ValidatorParams struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/crypto/hd
# [github.com/gnolang/gno/tm2/pkg/crypto/hd]
tm2/pkg/crypto/hd/hdpath_test.go:20:1: ExampleStringifyPathParams refers to unknown identifier: StringifyPathParams
tm2/pkg/crypto/hd/hdpath_test.go:112:1: ExampleSomeBIP32TestVecs refers to unknown identifier: SomeBIP32TestVecs
# github.com/gnolang/gno/tm2/pkg/db/boltdb
# [github.com/gnolang/gno/tm2/pkg/db/boltdb]
tm2/pkg/db/boltdb/boltdb.go:173:28: github.com/gnolang/gno/tm2/pkg/db/internal.Operation struct literal uses unkeyed fields
tm2/pkg/db/boltdb/boltdb.go:179:28: github.com/gnolang/gno/tm2/pkg/db/internal.Operation struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/store/cache_test
# [github.com/gnolang/gno/tm2/pkg/store/cache_test]
tm2/pkg/store/cache/store_test.go:18:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/cache/store_test.go:28:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/cache/store_test.go:73:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/cache/store_test.go:81:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/p2p
# [github.com/gnolang/gno/tm2/pkg/p2p]
tm2/pkg/p2p/switch.go:222:58: slog.Logger.Error arg "err" should be a string or a slog.Attr (possible missing key or value)
# github.com/gnolang/gno/tm2/pkg/store/gas_test
# [github.com/gnolang/gno/tm2/pkg/store/gas_test]
tm2/pkg/store/gas/store_test.go:23:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/gas/store_test.go:37:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/gas/store_test.go:63:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/gas/store_test.go:72:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/sdk
# [github.com/gnolang/gno/tm2/pkg/sdk]
tm2/pkg/sdk/baseapp_test.go:50:13: github.com/gnolang/gno/tm2/pkg/sdk/testutils.MsgCounter struct literal uses unkeyed fields
tm2/pkg/sdk/baseapp_test.go:123:15: github.com/gnolang/gno/tm2/pkg/store/types.CommitID struct literal uses unkeyed fields
tm2/pkg/sdk/baseapp_test.go:129:15: github.com/gnolang/gno/tm2/pkg/store/types.CommitID struct literal uses unkeyed fields
tm2/pkg/sdk/baseapp_test.go:187:15: github.com/gnolang/gno/tm2/pkg/store/types.CommitID struct literal uses unkeyed fields
tm2/pkg/sdk/baseapp_test.go:442:16: github.com/gnolang/gno/tm2/pkg/sdk/testutils.MsgCounter struct literal uses unkeyed fields
tm2/pkg/sdk/baseapp_test.go:679:28: github.com/gnolang/gno/tm2/pkg/sdk/testutils.MsgCounter2 struct literal uses unkeyed fields
tm2/pkg/sdk/baseapp_test.go:680:28: github.com/gnolang/gno/tm2/pkg/sdk/testutils.MsgCounter2 struct literal uses unkeyed fields
tm2/pkg/sdk/baseapp.go:396:2: unreachable code
# github.com/gnolang/gno/tm2/pkg/store/prefix
# [github.com/gnolang/gno/tm2/pkg/store/prefix]
tm2/pkg/store/prefix/store_test.go:109:9: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/prefix/store_test.go:118:15: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/prefix/store_test.go:168:15: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/prefix/store_test.go:200:15: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/prefix/store_test.go:228:14: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
tm2/pkg/store/prefix/store_test.go:259:11: github.com/gnolang/gno/tm2/pkg/store/dbadapter.Store struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/sdk/bank
# [github.com/gnolang/gno/tm2/pkg/sdk/bank]
tm2/pkg/sdk/bank/keeper_test.go:136:51: github.com/gnolang/gno/tm2/pkg/std.Coin struct literal uses unkeyed fields
# github.com/gnolang/gno/tm2/pkg/store/iavl
# [github.com/gnolang/gno/tm2/pkg/store/iavl]
tm2/pkg/store/iavl/store_test.go:49:15: github.com/gnolang/gno/tm2/pkg/store/types.CommitID struct literal uses unkeyed fields
tm2/pkg/store/iavl/store_test.go:61:8: github.com/gnolang/gno/tm2/pkg/store/types.CommitID struct literal uses unkeyed fields
@mvertes mvertes self-assigned this Oct 15, 2024
@mvertes mvertes added 🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related 📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Oct 15, 2024
thehowl pushed a commit that referenced this issue Oct 15, 2024
<!-- please provide a detailed description of the changes made in this
pull request. -->
Passing `go vet` is the minimum level of code quality for a go project.
This is addressed here for the full mono-repo. Mainly trivial changes,
except for a few `copy lock` issues which could be more meaningful (kept
for a separate pull request).

Addresses #2954 (but not sufficient to close it yet).

Hint for reviewers: it's easier to review each commit individually.
 
<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>
@Kouteki Kouteki added the in focus Core team is prioritizing this work label Oct 18, 2024
mvertes added a commit to mvertes/gno that referenced this issue Oct 18, 2024
Avoid copying of Mutex at several places.
Add missing lock / unlock calls.
Improve test coverage for protobuf timestamp and duration.

`go vet` doesn't complain anymore on Mutex copy.

Addresses gnolang#2954.
thehowl pushed a commit that referenced this issue Oct 21, 2024
Avoid copying of Mutex at several places.
Add missing lock / unlock calls.
Improve test coverage for protobuf timestamp and duration.

`go vet` doesn't complain anymore on Mutex copy.

Addresses #2954.

<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [*] Added new tests, or not needed, or not feasible
- [*] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [*] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [*] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
</details>
mvertes added a commit to mvertes/gno that referenced this issue Oct 22, 2024
…aces

amino codec.MarshallJSON has the same method name than Go standard library
`json.Marshaler` interface but with a different signature. This is
rejected by `go vet`. The same applies for codec.UnmarshallJSON vs
`json.Unmarshaler`. To fix that, we rename codec.MarshalJSON to
codec.JSONMarshal and codec.UnmarshalJSON to codec.JSONUnmarshal.

Now `go vet ./...' pass on the full mono-repo.

Fixes gnolang#2954.
@mvertes mvertes closed this as completed in 9096ef4 Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working in focus Core team is prioritizing this work 📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Development

Successfully merging a pull request may close this issue.

2 participants