Ahm. Very subtle.
Changed it to
bin := ""
bin, err = exec.LookPath(os.Args[0])
if err == nil {
wd = filepath.Dir(bin)
}
thanks for the feedback!
Le dimanche 26 juin 2016 00:00:51 UTC+2, Jan Mercl a écrit :
>
> On Sat, Jun 25, 2016 at 11:19 PM mhhcbon >
On Sat, Jun 25, 2016 at 11:19 PM mhhcbon wrote:
> bin, err := exec.LookPath(os.Args[0])
Note that this err variable is shadowing the one declared previously.
--
-j
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this gro
Hi,
i notice a case where LookPath is not really looking for PATH.
I have a bin with some files along it, i need to get its path at runtime to
find the other files.
I use a func like this, minus the fmt prints
func getBinPath() (string, error) {
var err error
wd := ""
if filepath.Base