chore: lint main with latest golangci-lint (#1419)

* bump golang and linter in ci

* cleanup lints

* use go 1.19

* don't use depguard, it causes problems with golangci-lint v1.53.1
This commit is contained in:
Jacob Gadikian
2023-06-06 14:17:35 +08:00
committed by GitHub
parent 5537735e00
commit 7500f5d625
4 changed files with 19 additions and 20 deletions

View File

@@ -61,7 +61,7 @@ jobs:
lint:
docker:
- image: golangci/golangci-lint:v1.50.1
- image: golangci/golangci-lint:v1.52.2
steps:
- checkout
- run:

View File

@@ -7,7 +7,6 @@ linters:
disable-all: true
enable:
- bodyclose
- depguard
- dogsled
- errcheck
- exportloopref

View File

@@ -64,7 +64,7 @@ func TestStoreCodeProposal(t *testing.T) {
ctx, _ := parentCtx.CacheContext()
myActorAddress := RandomBech32AccountAddress(t)
src := types.StoreCodeProposalFixture(func(p *types.StoreCodeProposal) {
src := types.StoreCodeProposalFixture(func(p *types.StoreCodeProposal) { //nolint:staticcheck // testing deprecated function
p.RunAs = myActorAddress
p.WASMByteCode = spec.code
p.UnpinCode = spec.unpinCode
@@ -141,7 +141,7 @@ func TestInstantiateProposal(t *testing.T) {
oneAddress sdk.AccAddress = bytes.Repeat([]byte{0x1}, types.ContractAddrLen)
otherAddress sdk.AccAddress = bytes.Repeat([]byte{0x2}, types.ContractAddrLen)
)
src := types.InstantiateContractProposalFixture(func(p *types.InstantiateContractProposal) {
src := types.InstantiateContractProposalFixture(func(p *types.InstantiateContractProposal) { //nolint:staticcheck // testing deprecated function
p.CodeID = firstCodeID
p.RunAs = oneAddress.String()
p.Admin = otherAddress.String()
@@ -200,7 +200,7 @@ func TestInstantiate2Proposal(t *testing.T) {
label = "label"
salt = []byte("mySalt")
)
src := types.InstantiateContract2ProposalFixture(func(p *types.InstantiateContract2Proposal) {
src := types.InstantiateContract2ProposalFixture(func(p *types.InstantiateContract2Proposal) { //nolint:staticcheck // testing deprecated function
p.CodeID = firstCodeID
p.RunAs = oneAddress.String()
p.Admin = otherAddress.String()
@@ -270,7 +270,7 @@ func TestInstantiateProposal_NoAdmin(t *testing.T) {
}
for name, spec := range specs {
t.Run(name, func(t *testing.T) {
src := types.InstantiateContractProposalFixture(func(p *types.InstantiateContractProposal) {
src := types.InstantiateContractProposalFixture(func(p *types.InstantiateContractProposal) { //nolint:staticcheck // testing deprecated function
p.CodeID = firstCodeID
p.RunAs = oneAddress.String()
p.Admin = spec.srcAdmin
@@ -338,7 +338,7 @@ func TestStoreAndInstantiateContractProposal(t *testing.T) {
otherAddress sdk.AccAddress = bytes.Repeat([]byte{0x2}, types.ContractAddrLen)
)
src := types.StoreAndInstantiateContractProposalFixture(func(p *types.StoreAndInstantiateContractProposal) {
src := types.StoreAndInstantiateContractProposalFixture(func(p *types.StoreAndInstantiateContractProposal) { //nolint:staticcheck // testing deprecated function
p.WASMByteCode = wasmCode
p.RunAs = oneAddress.String()
p.Admin = otherAddress.String()
@@ -418,7 +418,7 @@ func TestMigrateProposal(t *testing.T) {
migMsgBz, err := json.Marshal(migMsg)
require.NoError(t, err)
src := &types.MigrateContractProposal{
src := &types.MigrateContractProposal{ //nolint:staticcheck // testing deprecated function
Title: "Foo",
Description: "Bar",
CodeID: 2,
@@ -475,7 +475,7 @@ func TestExecuteProposal(t *testing.T) {
require.NoError(t, err)
// try with runAs that doesn't have pemission
badSrc := &types.ExecuteContractProposal{
badSrc := &types.ExecuteContractProposal{ //nolint:staticcheck // testing deprecated function
Title: "First",
Description: "Beneficiary has no permission to run",
Contract: contractAddr.String(),
@@ -494,7 +494,7 @@ func TestExecuteProposal(t *testing.T) {
require.Equal(t, bal.Amount, sdk.NewInt(100))
// try again with the proper run-as
src := &types.ExecuteContractProposal{
src := &types.ExecuteContractProposal{ //nolint:staticcheck // testing deprecated function
Title: "Second",
Description: "Verifier can execute",
Contract: contractAddr.String(),
@@ -540,7 +540,7 @@ func TestSudoProposal(t *testing.T) {
require.NoError(t, err)
// sudo can do anything
src := &types.SudoContractProposal{
src := &types.SudoContractProposal{ //nolint:staticcheck // testing deprecated function
Title: "Sudo",
Description: "Steal funds for the verifier",
Contract: contractAddr.String(),
@@ -574,7 +574,7 @@ func TestAdminProposals(t *testing.T) {
}{
"update with different admin": {
state: types.ContractInfoFixture(),
srcProposal: &types.UpdateAdminProposal{
srcProposal: &types.UpdateAdminProposal{ //nolint:staticcheck // testing deprecated function
Title: "Foo",
Description: "Bar",
Contract: contractAddr.String(),
@@ -586,7 +586,7 @@ func TestAdminProposals(t *testing.T) {
state: types.ContractInfoFixture(func(info *types.ContractInfo) {
info.Admin = ""
}),
srcProposal: &types.UpdateAdminProposal{
srcProposal: &types.UpdateAdminProposal{ //nolint:staticcheck // testing deprecated function
Title: "Foo",
Description: "Bar",
Contract: contractAddr.String(),
@@ -596,7 +596,7 @@ func TestAdminProposals(t *testing.T) {
},
"clear admin": {
state: types.ContractInfoFixture(),
srcProposal: &types.ClearAdminProposal{
srcProposal: &types.ClearAdminProposal{ //nolint:staticcheck // testing deprecated function
Title: "Foo",
Description: "Bar",
Contract: contractAddr.String(),
@@ -607,7 +607,7 @@ func TestAdminProposals(t *testing.T) {
state: types.ContractInfoFixture(func(info *types.ContractInfo) {
info.Admin = ""
}),
srcProposal: &types.ClearAdminProposal{
srcProposal: &types.ClearAdminProposal{ //nolint:staticcheck // testing deprecated function
Title: "Foo",
Description: "Bar",
Contract: contractAddr.String(),
@@ -710,7 +710,7 @@ func TestPinCodesProposal(t *testing.T) {
gotPinnedChecksums = nil
ctx, _ := parentCtx.CacheContext()
mock.PinFn = spec.mockFn
proposal := &types.PinCodesProposal{
proposal := &types.PinCodesProposal{ //nolint:staticcheck // testing deprecated function
Title: "Foo",
Description: "Bar",
CodeIDs: spec.srcCodeIDs,
@@ -800,7 +800,7 @@ func TestUnpinCodesProposal(t *testing.T) {
gotUnpinnedChecksums = nil
ctx, _ := parentCtx.CacheContext()
mock.UnpinFn = spec.mockFn
proposal := &types.UnpinCodesProposal{
proposal := &types.UnpinCodesProposal{ //nolint:staticcheck // testing deprecated function
Title: "Foo",
Description: "Bar",
CodeIDs: spec.srcCodeIDs,
@@ -898,7 +898,7 @@ func TestUpdateInstantiateConfigProposal(t *testing.T) {
govAuthority := keepers.AccountKeeper.GetModuleAddress(govtypes.ModuleName).String()
msgServer := govkeeper.NewMsgServerImpl(keepers.GovKeeper)
proposal := &types.UpdateInstantiateConfigProposal{
proposal := &types.UpdateInstantiateConfigProposal{ //nolint:staticcheck // testing deprecated function
Title: "Foo",
Description: "Bar",
AccessConfigUpdates: updates,

View File

@@ -463,7 +463,7 @@ func TestOnRecvPacket(t *testing.T) {
msg := wasmvmtypes.IBCPacketReceiveMsg{Packet: myPacket}
if spec.expPanic {
assert.Panics(t, func() {
keepers.WasmKeeper.OnRecvPacket(ctx, spec.contractAddr, msg)
_, _ = keepers.WasmKeeper.OnRecvPacket(ctx, spec.contractAddr, msg)
})
return
}