bazel-contrib / rules_go

Go rules for Bazel
Apache License 2.0
1.39k stars 664 forks source link

go_test: Set $HOME to value of $TEST_TMPDIR #3694

Open stevebarrau opened 1 year ago

stevebarrau commented 1 year ago

What version of rules_go are you using?

0.41.0

What version of Bazel are you using?

6.3.2

What operating system and processor architecture are you using?

macOS arm64

What did you do?

Write a go_test fo some feature in go that uses the user HOME.

What did you expect to see?

The rules_go test runner to follow the recommandation of https://bazel.build/reference/test-encyclopedia and set $HOME to the value of $TEST_TMPDIR.

What did you see instead?

The $HOME env var is not defined.

fmeum commented 1 year ago

We would welcome a contribution for this. It could probably go into the template used in https://github.com/bazelbuild/rules_go/blob/master/go/tools/builders/generate_test_main.go.