how to pass environment variables to a program when running/debugging?

121 views
Skip to first unread message

Dave Walz-Burkett

unread,
May 10, 2018, 2:06:21 AM5/10/18
to liteide-dev
hi all,

I have installed the latest version of LiteIDE (X33.3) on macos 10.13.4. No problems building go packages. When I try to run a program that looks for an environment variable, by calling os.Getenv("FLUFFY"), I get a panic message in the IDE: no value retrieved for environment variable 'FLUFFY'. My question is: how do I configure LiteIDE to pass environment variables to my program when I run or debug the program?

Looking at the LiteIDE documentation (http://liteide.org/en/doc/guide/), I should be able to configure an environment, like "darwin64-local" or "system". Is this the right place to add environment variables to be used by a program? If so, I've got a small problem - the default install of LiteIDE has the environment files in a read-only file system location (e.g. /private/var/folders/.../LiteIDE.app/Contents/Resources/liteenv/<environment name>.env)

Any help would be greatly appreciated.

cheers,
Dave



Olivier Gautherot

unread,
May 10, 2018, 8:17:35 AM5/10/18
to litei...@googlegroups.com
Hi Dave,

it may be a macos-specific issue - I just tested it on a FreeBSD machine. I compiled and ran a fmt.Println(os.Gentenv("FLUFFY")) without problem. If the environment variable does not exist, it simply prints an empty string.

Hope it helps...
Olivier

Olivier Gautherot
oli...@gautherot.net
Cel:+56 98 730 9361
Skype: ogautherot
www.gautherot.net
http://www.linkedin.com/in/ogautherot

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

Dave Walz-Burkett

unread,
May 10, 2018, 9:36:09 AM5/10/18
to liteide-dev
UPDATE:

Thanks for the feedback Olivier. I figured it out, for macos anyway. If I right-click on the LiteIDE.app file in Finder and choose the "Show Package Contents" menu option, I can find the environment config files (darwin64-local.env, system.env, etc.) in the LideIDE.app/Contents/Resources/liteenv directory. At that location, the files are writable and I just added the environment variable at the end (e.g. FLUFFY=/etc/fluffy.conf) of the appropriate file.

When I run LiteIDE again, the environment files are still read-only within LiteIDE, but my changes to the environment files are visible.

Thanks again!

cheers,
Dave
Reply all
Reply to author
Forward
0 new messages