Skip to content
GitHub Actions / golangci failed Dec 5, 2023 in 1s

reviewdog [golangci] report

reported by reviewdog 🐶

Findings (29)

pkg/testsuite/mqtt_test.go|443| 443-483 lines are duplicate of pkg/testsuite/mqtt_test.go:575-615 (dupl)
pkg/testsuite/mqtt_test.go|575| 575-615 lines are duplicate of pkg/testsuite/mqtt_test.go:443-483 (dupl)
pkg/testsuite/mqtt_test.go|892 col 35| string /raw has 6 occurrences, make it a constant (goconst)
pkg/testsuite/broker_mock.go|79 col 2| commentFormatting: put a space between // and comment text (gocritic)
pkg/testsuite/mqtt_test.go|7| File is not goimports-ed with -local github.com/iotaledger (goimports)
pkg/testsuite/mqtt_test.go|887 col 23| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|905 col 23| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|913 col 34| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|926 col 33| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|940 col 7| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|941 col 5| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|945 col 30| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|956 col 7| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|957 col 5| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/mqtt_test.go|964 col 30| Using the variable on range scope test in function literal (scopelint)
pkg/testsuite/nodebridge_mock.go|412 col 2| ctx is unused (structcheck)
pkg/testsuite/nodebridge_mock.go|413 col 2| cancel is unused (structcheck)
pkg/testsuite/nodebridge_mock.go|414 col 2| receiverChan is unused (structcheck)
pkg/testsuite/testsuite.go|224 col 2| missing cases in switch of type iotago.OutputType: iotago.OutputBasic, iotago.OutputAccount, iotago.OutputNFT, iotago.OutputDelegation (exhaustive)
pkg/testsuite/testsuite.go|203 col 2| type assertion must be checked (forcetypeassert)
pkg/testsuite/testsuite.go|234 col 2| type assertion must be checked (forcetypeassert)
pkg/testsuite/mqtt_test.go|444 col 4| type assertion must be checked (forcetypeassert)
pkg/testsuite/mqtt_test.go|487 col 4| type assertion must be checked (forcetypeassert)
pkg/testsuite/mqtt_test.go|532 col 4| type assertion must be checked (forcetypeassert)
pkg/testsuite/mqtt_test.go|576 col 4| type assertion must be checked (forcetypeassert)
pkg/testsuite/mqtt_test.go|619 col 4| type assertion must be checked (forcetypeassert)
pkg/testsuite/mqtt_test.go|746 col 4| type assertion must be checked (forcetypeassert)
pkg/testsuite/mqtt_test.go|812 col 4| type assertion must be checked (forcetypeassert)
pkg/testsuite/nodebridge_mock.go|438 col 4| return with no blank line before (nlreturn)

Filtered Findings (0)

Annotations

Check failure on line 443 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L443

443-483 lines are duplicate of `pkg/testsuite/mqtt_test.go:575-615` (dupl)
Raw output
pkg/testsuite/mqtt_test.go:443: 443-483 lines are duplicate of `pkg/testsuite/mqtt_test.go:575-615` (dupl)
		func() *test {
			accountOutput := tpkg.RandOutput(iotago.OutputAccount).(*iotago.AccountOutput)
			testTx := ts.NewTestTransaction(true, tpkg.WithOutputs(iotago.Outputs[iotago.TxEssenceOutput]{
				accountOutput,
			}))

			return &test{
				name: "ok - TopicAccountOutputs",
				topics: []*testTopic{
					{
						topic:           mqtt.GetTopicAccountOutputs(accountOutput.AccountID, ts.API().ProtocolParameters().Bech32HRP()),
						isPollingTarget: false,
						isEventTarget:   true,
					},
				},
				topicsIgnore: []string{
					mqtt.GetTopicTransactionsIncludedBlock(testTx.TransactionID),
					mqtt.GetTopicOutput(testTx.ConsumedOutputID),
					mqtt.GetTopicOutput(testTx.OutputID),
					mqtt.GetTopicOutputsByUnlockConditionAndAddress(mqtt.UnlockConditionAny, testTx.OwnerAddress, ts.API().ProtocolParameters().Bech32HRP()),
					mqtt.GetTopicOutputsByUnlockConditionAndAddress(mqtt.UnlockConditionAddress, testTx.OwnerAddress, ts.API().ProtocolParameters().Bech32HRP()),
				},
				jsonTarget: lo.PanicOnErr(ts.API().JSONEncode(testTx.OutputWithMetadataResponse)),
				rawTarget:  lo.PanicOnErr(ts.API().Encode(testTx.OutputWithMetadataResponse)),
				postSubscribeFunc: func() {
					ts.ReceiveAcceptedTransaction(&nodebridge.AcceptedTransaction{
						API:           ts.API(),
						Slot:          testTx.BlockID.Slot(),
						TransactionID: testTx.TransactionID,
						// the consumed input
						Consumed: []*nodebridge.Output{
							ts.NewSpentNodeBridgeOutputFromTransaction(tpkg.RandBlockID(), testTx.ConsumedOutputCreationTransaction, testTx.BlockID.Slot(), testTx.TransactionID),
						},
						// the created output
						Created: []*nodebridge.Output{
							ts.NewNodeBridgeOutputFromOutputWithMetadata(testTx.OutputWithMetadataResponse),
						},
					})
				},
			}
		}(),

Check failure on line 575 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L575

575-615 lines are duplicate of `pkg/testsuite/mqtt_test.go:443-483` (dupl)
Raw output
pkg/testsuite/mqtt_test.go:575: 575-615 lines are duplicate of `pkg/testsuite/mqtt_test.go:443-483` (dupl)
		func() *test {
			nftOutput := tpkg.RandOutput(iotago.OutputNFT).(*iotago.NFTOutput)
			testTx := ts.NewTestTransaction(true, tpkg.WithOutputs(iotago.Outputs[iotago.TxEssenceOutput]{
				nftOutput,
			}))

			return &test{
				name: "ok - TopicNFTOutputs",
				topics: []*testTopic{
					{
						topic:           mqtt.GetTopicNFTOutputs(nftOutput.NFTID, ts.API().ProtocolParameters().Bech32HRP()),
						isPollingTarget: false,
						isEventTarget:   true,
					},
				},
				topicsIgnore: []string{
					mqtt.GetTopicTransactionsIncludedBlock(testTx.TransactionID),
					mqtt.GetTopicOutput(testTx.ConsumedOutputID),
					mqtt.GetTopicOutput(testTx.OutputID),
					mqtt.GetTopicOutputsByUnlockConditionAndAddress(mqtt.UnlockConditionAny, testTx.OwnerAddress, ts.API().ProtocolParameters().Bech32HRP()),
					mqtt.GetTopicOutputsByUnlockConditionAndAddress(mqtt.UnlockConditionAddress, testTx.OwnerAddress, ts.API().ProtocolParameters().Bech32HRP()),
				},
				jsonTarget: lo.PanicOnErr(ts.API().JSONEncode(testTx.OutputWithMetadataResponse)),
				rawTarget:  lo.PanicOnErr(ts.API().Encode(testTx.OutputWithMetadataResponse)),
				postSubscribeFunc: func() {
					ts.ReceiveAcceptedTransaction(&nodebridge.AcceptedTransaction{
						API:           ts.API(),
						Slot:          testTx.BlockID.Slot(),
						TransactionID: testTx.TransactionID,
						// the consumed input
						Consumed: []*nodebridge.Output{
							ts.NewSpentNodeBridgeOutputFromTransaction(tpkg.RandBlockID(), testTx.ConsumedOutputCreationTransaction, testTx.BlockID.Slot(), testTx.TransactionID),
						},
						// the created output
						Created: []*nodebridge.Output{
							ts.NewNodeBridgeOutputFromOutputWithMetadata(testTx.OutputWithMetadataResponse),
						},
					})
				},
			}
		}(),

Check failure on line 892 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L892

string `/raw` has 6 occurrences, make it a constant (goconst)
Raw output
pkg/testsuite/mqtt_test.go:892:35: string `/raw` has 6 occurrences, make it a constant (goconst)
				topicNameRaw := topic.topic + "/raw"
				                              ^

Check failure on line 79 in pkg/testsuite/broker_mock.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/broker_mock.go#L79

commentFormatting: put a space between `//` and comment text (gocritic)
Raw output
pkg/testsuite/broker_mock.go:79:2: commentFormatting: put a space between `//` and comment text (gocritic)
	//if m.sendCallback != nil {
	^

Check failure on line 7 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L7

File is not `goimports`-ed with -local github.com/iotaledger (goimports)
Raw output
pkg/testsuite/mqtt_test.go:7: File is not `goimports`-ed with -local github.com/iotaledger (goimports)

Check failure on line 887 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L887

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:887:23: Using the variable on range scope `test` in function literal (scopelint)
					require.Equal(t, test.jsonTarget, payloadBytes, "JSON payload mismatch")
					                 ^

Check failure on line 905 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L905

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:905:23: Using the variable on range scope `test` in function literal (scopelint)
					require.Equal(t, test.rawTarget, payloadBytes, "raw payload mismatch")
					                 ^

Check failure on line 913 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L913

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:913:34: Using the variable on range scope `test` in function literal (scopelint)
				for _, ignoredTopic := range test.topicsIgnore {
				                             ^

Check failure on line 926 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L926

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:926:33: Using the variable on range scope `test` in function literal (scopelint)
			collectedTopics := lo.Reduce(test.topics, func(collectedTopics map[string]int, topic *testTopic) map[string]int {
			                             ^

Check failure on line 940 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L940

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:940:7: Using the variable on range scope `test` in function literal (scopelint)
			if test.preSubscribeFunc != nil {
			   ^

Check failure on line 941 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L941

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:941:5: Using the variable on range scope `test` in function literal (scopelint)
				test.preSubscribeFunc()
				^

Check failure on line 945 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L945

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:945:30: Using the variable on range scope `test` in function literal (scopelint)
			for _, testTopic := range test.topics {
			                          ^

Check failure on line 956 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L956

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:956:7: Using the variable on range scope `test` in function literal (scopelint)
			if test.postSubscribeFunc != nil {
			   ^

Check failure on line 957 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L957

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:957:5: Using the variable on range scope `test` in function literal (scopelint)
				test.postSubscribeFunc()
				^

Check failure on line 964 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L964

Using the variable on range scope `test` in function literal (scopelint)
Raw output
pkg/testsuite/mqtt_test.go:964:30: Using the variable on range scope `test` in function literal (scopelint)
			for _, testTopic := range test.topics {
			                          ^

Check failure on line 412 in pkg/testsuite/nodebridge_mock.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/nodebridge_mock.go#L412

`ctx` is unused (structcheck)
Raw output
pkg/testsuite/nodebridge_mock.go:412:2: `ctx` is unused (structcheck)
	ctx          context.Context
	^

Check failure on line 413 in pkg/testsuite/nodebridge_mock.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/nodebridge_mock.go#L413

`cancel` is unused (structcheck)
Raw output
pkg/testsuite/nodebridge_mock.go:413:2: `cancel` is unused (structcheck)
	cancel       context.CancelFunc
	^

Check failure on line 414 in pkg/testsuite/nodebridge_mock.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/nodebridge_mock.go#L414

`receiverChan` is unused (structcheck)
Raw output
pkg/testsuite/nodebridge_mock.go:414:2: `receiverChan` is unused (structcheck)
	receiverChan chan *T
	^

Check failure on line 224 in pkg/testsuite/testsuite.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/testsuite.go#L224

missing cases in switch of type iotago.OutputType: iotago.OutputBasic, iotago.OutputAccount, iotago.OutputNFT, iotago.OutputDelegation (exhaustive)
Raw output
pkg/testsuite/testsuite.go:224:2: missing cases in switch of type iotago.OutputType: iotago.OutputBasic, iotago.OutputAccount, iotago.OutputNFT, iotago.OutputDelegation (exhaustive)
	switch createdOutput.Type() {
	^

Check failure on line 203 in pkg/testsuite/testsuite.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/testsuite.go#L203

type assertion must be checked (forcetypeassert)
Raw output
pkg/testsuite/testsuite.go:203:2: type assertion must be checked (forcetypeassert)
	transaction := &iotago.Transaction{
	^

Check failure on line 234 in pkg/testsuite/testsuite.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/testsuite.go#L234

type assertion must be checked (forcetypeassert)
Raw output
pkg/testsuite/testsuite.go:234:2: type assertion must be checked (forcetypeassert)
	consumedOutput := tpkg.RandOutput(iotago.OutputBasic).(*iotago.BasicOutput)
	^

Check failure on line 444 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L444

type assertion must be checked (forcetypeassert)
Raw output
pkg/testsuite/mqtt_test.go:444:4: type assertion must be checked (forcetypeassert)
			accountOutput := tpkg.RandOutput(iotago.OutputAccount).(*iotago.AccountOutput)
			^

Check failure on line 487 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L487

type assertion must be checked (forcetypeassert)
Raw output
pkg/testsuite/mqtt_test.go:487:4: type assertion must be checked (forcetypeassert)
			anchorOutput := tpkg.RandOutput(iotago.OutputAnchor).(*iotago.AnchorOutput)
			^

Check failure on line 532 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L532

type assertion must be checked (forcetypeassert)
Raw output
pkg/testsuite/mqtt_test.go:532:4: type assertion must be checked (forcetypeassert)
			foundryOutput := tpkg.RandOutput(iotago.OutputFoundry).(*iotago.FoundryOutput)
			^

Check failure on line 576 in pkg/testsuite/mqtt_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/testsuite/mqtt_test.go#L576

type assertion must be checked (forcetypeassert)
Raw output
pkg/testsuite/mqtt_test.go:576:4: type assertion must be checked (forcetypeassert)
			nftOutput := tpkg.RandOutput(iotago.OutputNFT).(*iotago.NFTOutput)
			^