Best way to run a sync one-time configuration task


I’m working on modifying someone else’s package and there’s a step where we need to detect if the appropriate tools are installed in the environment or not. I’m pretty new to this style of development, so I keep looking for a way to run a sync process to detect the appropriate environment settings and executables. (Specifically, using BufferedProcess to run some local executables, verifying env vars, etc).

I get that sync (vs async) isn’t the Happy Path, so I’m curious about the best way to “notify” the package that all of it’s pieces have been successfully located. Hopefully this is obvious and I’m being silly :smile:



Well I think you’re modifying my package, so how can I help? Keep in mind we already bootstrap an entire functioning environment in the Travis bootstrap script for CI.

What issues are you running into? Follow me on Twitter and we can DM.


Re-reading it sounds like you want to potentially highlight to the user if their GOPATH is bad, if their GoFmtPath, GoExecutable, etc do not exist. We already highlight GOPATH related things here:, but it sounds like you want to add additional checking when the package loads?

I think that would be a good feature. Perhaps create an issue in the repo describing functionally what it should achieve and we can collaborate on it? Happy to help.


Yes! Thanks for finding me here! I’ll respond more to the specifics below.

I don’t have a Twitter account, unfortunately, and … have reasons not to get one.

Basically, the gist is that ‘go env’ is the entry point for convenient tooling around go (I ran into this same issue with the Idea Go plugin). Once you can get to “go”, you can get “go env”, and then you can get “GOROOT”, “GOPATH”, etc (if they’re set).

The way the code is written now, there’s manual variable substitution (which won’t work in some cases, because it’s only doing substitution, when various BASH/SH variables will work), and manual building of command paths, etc.

To try and work around this, I started trying to make the config process use ‘go env’, but it’s async, and the current config and test are sync. Hence my question. So I’m trying to simply replace the manual path substitution with calls to ‘go env’ and using the standard libraries.

So yeah, in go-plus, where’s the place to stick an async config call to find ‘go env’?


Actually, I’m not worried about highlighting it (you already had code for that), it’s mostly the way it’s found (from above). So, yeah, async via process vs string processing, etc


BTW, personal note, you’ve been very nice and helpful throughout this process. I’m brand new to coding like this, so I’ve been trying to avoid bombarding you with questions, but I appreciate your interest. Thanks for being so kind!


Got the tests to pass for a PATH-based executor. Will work on the negative tests shortly.


So, I punted on this and basically learned how to do it asynchronously. Just a learning-curve issue, this can be closed.