Pass arguments when running the app

I would like to pass arguments to my Go executable when I run it but I don't know how to do that. I tried to specify them in Environment and Program arguments because I don't understand the difference.

Here is a screenshot of what I tried

I would like to specify a flag that will be parsed by the flag library of Go.

Thanks in advance for your help

0
2 comments
Official comment

Hi Clay,

Here you can read about environment: https://en.wikipedia.org/wiki/Environment_variable

Program arguments field is what you need. You can verify that they were passed in command line string of Run tool window:

Assuming you have a dbuser flag defined

var dbUserName = flag.String("dbuser", "unknown", "help message for dbuser")
and call 

flag.Parse()

Your setting should do the job.
0

Please sign in to leave a comment.