I was researching ways of doing various things over Tor (in go), and the only way so far that I've seen is by connecting to 127.0.0.1:9050
as a SOCKS5 proxy and talking over that.
However, in a program that end-users would receive, this would require them setting up tor on their own.
Is there some way of packaging it with the project so that when run, it automatically sets up tor - temporarily - on its own?
On Linux I recommend you specify Tor as a dependency when distributing your package. An example of this can be seen with Arch Linux's pkgbuild
dependencies.
If people want manually check out your code and build on it, you will just have to tell them to install Tor. (Via a README, and a hard error upon execution of your program, where Tor is not installed.)