Skip to content

Error message on Len() assumes string  #1482

Closed
@kevinburkesegment

Description

@kevinburkesegment

This error message in assert.Len assumes that whatever you are asserting a length about can be formatted with the %s format string.

	if l != length {
		return Fail(t, fmt.Sprintf("\"%s\" should have %d item(s), but has %d", object, length, l), msgAndArgs...)
	}

If you look at the failure in e.g. https://drone.grafana.net/grafana/dskit/3189/1/4, I believe this is a []uint32, which is being formatted as "[%!s(uint32=2452015680) %!s(uint32=2476020736)]".

I think the %v format string might be a better fit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions