FAQ
Hi,

In a situation like this:

$ go get github.com/.../mytool
$ ls $GOPATH/src/github.com/.../
conf.txt
mytool/mytool.go
$ ls $GOPATH/bin
mytool

Is there any way to let mytool (the binary installed under $GOPATH/bin)
know where the configuration file is? I mean, without having to...

$ mytool --config_path=$GOPATH/src/github.com/.../conf.txt

Is this a question as stupid as it seems?

Cheers,

M;

--

Search Discussions

  • Sebastien Binet at Oct 9, 2012 at 6:14 pm
    Miguel,
    Hi,

    In a situation like this:

    $ go get github.com/.../mytool
    $ ls $GOPATH/src/github.com/.../
    conf.txt
    mytool/mytool.go
    $ ls $GOPATH/bin
    mytool

    Is there any way to let mytool (the binary installed under $GOPATH/bin)
    know where the configuration file is? I mean, without having to...

    $ mytool --config_path=$GOPATH/src/github.com/.../conf.txt
    using go/build, you can retrieve the path to $GOPATH and then get at
    that pesky configuration file.

    e.g.
    https://github.com/sbinet/go-root2pb/blob/master/utils.go#L32

    -s

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 9, '12 at 4:13p
activeOct 9, '12 at 6:14p
posts2
users2
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase