Skip to content

panic: runtime error: index out of range [4] with length 4 #364

Description

@shubham-dogra-s1

Specifications

  • Xgo Version: 1.10
  • Go version: 1.24.4
  • OS: Sequoia 15.5
  • Processor: M3 Pro
type KafkaManager struct {}

type PSTopic struct {
	Name       string
	Partitions int
	Manager    *KafkaManager
}


func (t *PSTopic) Publish(message []byte, partition int, headers map[string]string) {
	t.Manager.Publish(t, message, partition, headers)
}

topic := &PsTopic{}

mock.PatchMethodByName(topic, "Publish", func(message []byte, partition int, headers map[string]string) {

})
panic: runtime error: index out of range [4] with length 4 [recovered]
	panic: runtime error: index out of range [4] with length 4

goroutine 11 [running]:
testing.tRunner.func1.2({0x108092e80, 0x14000a28eb8})
	/Users/user/.xgo/go-instrument/go1.24.4_us_lo_go_fa839386/go1.24.4/src/testing/testing.go:1734 +0x1ac
testing.tRunner.func1()
	/Users/user/.xgo/go-instrument/go1.24.4_us_lo_go_fa839386/go1.24.4/src/testing/testing.go:1737 +0x334
panic({0x108092e80?, 0x14000a28eb8?})
	/Users/user/.xgo/go-instrument/go1.24.4_us_lo_go_fa839386/go1.24.4/src/runtime/panic.go:792 +0x124
reflect.(*rtype).In(0x140003e8b20?, 0x107d3a340?)
	/Users/user/.xgo/go-instrument/go1.24.4_us_lo_go_fa839386/go1.24.4/src/reflect/type.go:793 +0x94
github.com/xhd2015/xgo/runtime/internal/trap.checkFuncTypeMatch({0x10837d230, 0x107c2d9e0}, {0x10837d230, 0x107baf2a0}, 0x1)
	/Users/user/go/pkg/mod/github.com/xhd2015/xgo/runtime@v1.1.10/internal/trap/object.go:172 +0xe8
github.com/xhd2015/xgo/runtime/internal/trap.pushMockReplacerMethodByName({0x107d3a340, 0x140003e8b20}, {0x106a4b7ce, 0x7}, {0x107baf2a0, 0x1082fcb68})
	/Users/user/go/pkg/mod/github.com/xhd2015/xgo/runtime@v1.1.10/internal/trap/mock.go:320 +0xf0
github.com/xhd2015/xgo/runtime/internal/trap.PushMockReplacerMethodByName(...)
	/Users/user/go/pkg/mod/github.com/xhd2015/xgo/runtime@v1.1.10/internal/trap/mock.go:55
github.com/xhd2015/xgo/runtime/mock.PatchMethodByName(...)
	/Users/user/go/pkg/mod/github.com/xhd2015/xgo/runtime@v1.1.10/mock/patch.go:23
practise/internal/kafkaworkflows.TestHandlePostNormalizedEvents.func2(0x107a00020?, 0x10a42d000?, 0x107a469a0?)
	/Users/user/GolandProjects/practise/internal/kafkaworkflows/handlers_test.go:397 +0x48
practise/internal/kafkaworkflows.TestHandlePostNormalizedEvents.func3(0x14000c9fa40)
	/Users/user/GolandProjects/practise/internal/kafkaworkflows/handlers_test.go:576 +0x16c
testing.tRunner(0x14000c9fa40, 0x140002f9900)
	/Users/user/.xgo/go-instrument/go1.24.4_us_lo_go_fa839386/go1.24.4/src/testing/testing.go:1792 +0xe4
created by testing.(*T).Run in goroutine 10
	/Users/user/.xgo/go-instrument/go1.24.4_us_lo_go_fa839386/go1.24.4/src/testing/testing.go:1851 +0x374

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions