I'd personally like this to go it. If there is a dependency on /proc on
linux, then we can document that as a BUG for now(?). I've already coded
similar code for linux,windows, and osx (using cgo), so I personally
require and use the functionality this provides on multiple platforms. I
think this would also be fine for a go get package, but osx requires
runtime changes for this to work without cgo.
name suggestion? ProcessFilePath(), ProcessPath()
Use cases for this call:
* Get a path to the exec when creating a "service" on windows, upstart,
launchd.
* I often bundle resources next to the exec for easy deployment.
Without this I have to watch my working directory when I call it. Not
horrible,
but much easier just to get the path the OS already knows, no guesswork
required,
same deployment on all systems.
.. I understand these use cases are not relevant for many projects for many
people, but they
are useful to me, especially when I have a number of smaller one off
projects on different platforms,
it greatly simplifies my code and deployment to use this functionality...
On Wednesday, October 24, 2012 1:12:43 AM UTC-7, minux wrote:On 2012/10/24 07:30:00, taruti wrote:
We frequently run go things inside chroots without /proc - please
don't make
this impossible. Just having this API does not break things, but any
code in the
the fact that this API depends on procfs doesn't mean you cannot run Go
programs
without procfs, you just cannot use the new API.
stdlib depending on this working would be nasty.
Why? procfs is standard part of Linux, and lots of things will break if
it's missing.
I think you must understand this implication when you chroot to a
directory
without procfs.
for instance, the os package is already using /proc/sys/kernel/hostname
to
get the hostname. Because procfs is a integrated part of linux, there
are problems
that are not solvable without it (for example, ps(1)), AFAIK.
However, if you could provide a portable way to implement this API on
Linux
without resorting to procfs, i'd like to adapt it.
(by portable, I mean it needs to support Linux 2.6.23+)
https://codereview.appspot.com/6736069/