go-delve/delve · error

evaluating methods not supported on this version of Go

Error message

evaluating methods not supported on this version of Go

What it means

errMethodEvalUnsupported is returned when evaluating a method value/type requires synthesizing a function type from a subprogram DIE, which is only possible on Go 1.10+. Versions of Go prior to 1.10 do not distinguish parameters from return values in DWARF, so Delve cannot derive a method's fake type. The error surfaces through Function.fakeType in pkg/proc/eval.go.

Source

Thrown at pkg/proc/eval.go:3214

	v.Value = constant.MakeString(fn.Name)
	v.loaded = true
	v.Base = fn.Entry
	return v, nil
}

func fakeArrayType(n uint64, fieldType godwarf.Type) godwarf.Type {
	stride := alignAddr(fieldType.Common().ByteSize, fieldType.Align())
	return &godwarf.ArrayType{
		CommonType: godwarf.CommonType{
			ReflectKind: reflect.Array,
			ByteSize:    int64(n) * stride,
			Name:        fmt.Sprintf("[%d]%s", n, fieldType.String())},
		Type:          fieldType,
		StrideBitSize: stride * 8,
		Count:         int64(n)}
}

var errMethodEvalUnsupported = errors.New("evaluating methods not supported on this version of Go")

func (fn *Function) fakeType(bi *BinaryInfo, removeReceiver bool) (*godwarf.FuncType, error) {
	if producer := bi.Producer(); producer == "" || !goversion.ProducerAfterOrEqual(producer, 1, 10) {
		// versions of Go prior to 1.10 do not distinguish between parameters and
		// return values, therefore we can't use a subprogram DIE to derive a
		// function type.
		return nil, errMethodEvalUnsupported
	}
	_, formalArgs, err := funcCallArgs(fn, bi, true)
	if err != nil {
		return nil, err
	}

	// Only try and remove the receiver if it is actually being passed in as a formal argument.
	// In the case of:
	//
	// func (_ X) Method() { ... }
	//

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Rebuild the target binary with Go 1.10 or newer (ideally current Go)
  2. If rebuilding is impossible, evaluate the method's underlying function value directly instead of the method expression
  3. Upgrade Delve if needed to ensure it matches the target Go version

Example fix

// before: debug binary built with go1.9
dlv> print x.MethodValue
// after: rebuild
go build -gcflags="all=-N -l" ./cmd/app
dlv> print x.MethodValue
Defensive patterns

Strategy: validation

Validate before calling

// check target's Go version before method evaluation
producer := bi.Producer() // must be >= go1.10 for method eval
// CLI: dlv> version

Try / catch

if err := eval(...); err != nil && strings.Contains(err.Error(), "methods not supported") {
    // fall back to inspecting fields instead of methods
}

Prevention

When it happens

Trigger: Debugging a binary produced by Go < 1.10 and evaluating an expression that requires a method's type (e.g. printing a method value or calling through an interface) which triggers fakeType with removeReceiver.

Common situations: Attaching Delve to a very old pre-built binary; CI environments with stale toolchains; legacy production binaries that were never rebuilt with a modern Go version.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/01aac45b72669666. Report an issue: GitHub.