Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

TestTrimGOPATH fails when vendored #77

@exp

Description

@exp

Due to using a simple string inequality test this function will fail if the errors package is located in a vendor subdirectory:

--- FAIL: TestTrimGOPATH (0.00s)
        stack_test.go:165: stack_test.go:9: want "github.com/pkg/errors/stack_test.go", got "example.org/test/vendor/github.com/pkg/errors/stack_test.go"

A simple fix is to replace lines 163-166 with the same testFormatRegex function used elsewhere:

want := tt.want
if want != got {
    t.Errorf("%v: want %q, got %q", tt.Frame, want, got)
}

to

testFormatRegexp(t, got, "%s", tt.want)

This also requires changing the line numbers on the rest of the file, so a pull request is incoming shortly. This will also slightly change the error message returned when this test fails but I am not sure if that of any great consequence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions