Inside of an Ubuntu 24.04 container, on a Fedora Linux 43.20251117.0 (Kinoite) system, I generate a coverage.out file:
semantic-tag on main [!+?] via 🐹 v1.25.4
⬢ [ubuntu-toolbox-24.04] ❯ go test -failfast -cover -race -coverprofile=coverage.out ./...
I then call go’s cover tool to launch my default, Firefox, browser to visualize the coverage results:
semantic-tag on main [!+?] via 🐹 v1.25.4
⬢ [ubuntu-toolbox-24.04] ❯ go tool cover -html=coverage.out
HTML output written to /tmp/cover3391820812/coverage.html
However, all I get is the generated .html file. My browser is not launched.
When I exit the container and run the same command, my browser launches and displays the contents of the file:
semantic-tag on main [!+?] via 🐹 v1.25.4
⬢ [ubuntu-toolbox-24.04] ❯ exit
exit
semantic-tag on main [!+?] via 🐹 v1.25.4 took 4h8m37s
❯ go tool cover -html=coverage.out
I am not sure what the best practice is for this workflow. Am I missing a step to launch my browser from a command invoked within the container, or am I supposed to just call the go tool cover command from outside of the container?
