Skip to content

CallerInfo change prints sandbox path in error trace when using Bazel #1230

@OscarVanL

Description

@OscarVanL

When I run my tests via Bazel, after the 1.8.0 change where CallerInfo displays the full path to the terminal I now get quite spammy outputs. Looks to be from #1201

This is because Bazel runs your code within a sandbox, and this change is now printing the path to the sandbox location rather than the sources location.

Eg:

bazel test --test_output=errors //...

--- FAIL: TestFooUnitTestSuite (0.01s)
    --- FAIL: TestFooUnitTestSuite/TestBar(0.00s)
        --- FAIL: TestFoo/TestBar/When_there_is_an_error (0.00s)
            foo_test.go:1694: 
                        Error Trace:    /private/var/tmp/_bazel_oscar/5dc9f0e710b2578b352c533d7f70060e/sandbox/darwin-sandbox/929/execroot/my_bazel_workspace/bazel-out/darwin-fastbuild/bin/src/foo/internal/datastore/datastore_test_/datastore_test.runfiles/my_bazel_workspace/src/foo/internal/datastore/foo_test.go:1694

Ideally, instead of this huge string it would just print src/foo/internal/datastore/foo_test.go:1694 as the path

As a result of this change, I can no longer CTRL+Click on the error trace path to find the responsible source code as VSCode doesn't understand this huge path.

Is there any way to switch to the old error trace path in this case? Thanks!

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