On Tue, Feb 26, 2019 at 2:09 PM Natxo Asenjo <natxo.ase...@gmail.com> wrote:

>
>
> On Tue, Feb 26, 2019 at 10:58 AM Natxo Asenjo <natxo.ase...@gmail.com>
> wrote:
>
>>
>> hi,
>>
>> On Tuesday, February 26, 2019 at 10:51:28 AM UTC+1, Sebastien Binet wrote:
>>>
>>> from the compilation error, it would seem kingpin.Flag...ExistingFile()
>>> returns a *string, not a string.
>>> so these lines:
>>>  fmt.Printf("%v, %s, %T\n", config, config, config)
>>>  cfg, err := ini.Load(config)
>>> should be replaced with:
>>>  fmt.Printf("%v, %s, %T\n", *config, *config, *config)
>>>  cfg, err := ini.Load(*config)
>>>
>>> Thanks!
>>
>> I had indeed already tried that but alas:
>>
>> $ go run kk.go --config api.conf
>> , , string
>> open : no such file or directory
>> exit status 1
>>
>> after dereferencing config, it appears to be empty.
>>
>>
> it appears that defining the config variable and the other variables
> globally does not work. If I define the url/api/user/pwd in main(), then I
> can use the config variable as expected (indeed with a pointer *config).
>
I believe (but I am no kingpin expert) that declaring them globally is fine.
what is probably the issue here is to call kingpin.Parse() during init().
try moving that code inside main() and see what gives.

hth,
-s

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to