Open Saurbaum opened 8 years ago
Does go run
work from the command line? If so, can you provide the working command line?
The build package is just invoking the cli, so it may just be a limitation of the cli tool. If not, we just need to identify what is different about the two.
For go run
to work you need to pass all *.go files comprising the main package to the go run
command line. Given the files mentioned in the original post the build package would need to execute go run main.go util.go
.
This scenario may become tricky if it is necessary to filter out test files or files for other platforms.
The go run
docs are here: https://golang.org/cmd/go/#hdr-Compile_and_run_Go_program.
Thanks for that info @ChrisHines.
What you'll most likely need to do in your situation @Saurbaum is to set up custom "flags". https://github.com/golang/sublime-build/blob/master/docs/configuration.md#command-flags has the general docs. At the bottom of https://github.com/golang/sublime-build/blob/master/docs/configuration.md#using-command-flags-to-specify-build-run-and-install-targets you can see an example of setting up the Run
variant to always be passed specific args.
I think this should allow for your situation, but let me know if it doesn't.
I'll try it in the morning GMT when the beers have worn off and I'm less likely to mess it up.
Thanks
On 10 Oct 2016 19:00, "Will Bond" notifications@github.com wrote:
Thanks for that info @ChrisHines https://github.com/ChrisHines.
What you'll most likely need to do in your situation @Saurbaum https://github.com/Saurbaum is to set up custom "flags". https://github.com/golang/sublime-build/blob/master/ docs/configuration.md#command-flags has the general docs. At the bottom of https://github.com/golang/sublime-build/blob/master/ docs/configuration.md#using-command-flags-to-specify- build-run-and-install-targets you can see an example of setting up the Run variant to always be passed specific args.
I think this should allow for your situation, but let me know if it doesn't.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/golang/sublime-build/issues/25#issuecomment-252694695, or mute the thread https://github.com/notifications/unsubscribe-auth/AG84EEpSDuTBKiOeI07PaChYw8m_Q7Krks5qyn0lgaJpZM4KSvp- .
I took my life into my hands and took a shot.
I have it working but it would be neater if I could put a relative path to the project file rather than to GOPATH. Then it would look like the go command line version.
If I recall, the only reason it needs to be relative to GOPATH is so you can run from anywhere in your project.
It's working fine in Windows. Importing the same package in OSX it doesn't seem to be picking up the .sublime-project file.
If I attempt to split my main package over 2 files to add a little neatness I can compile but I can't run through Sublime.
eg main.go and util.go both start with
package main
Ctrl Shift B and selecting Go Run will result in an error when methods in main.go attempt to call anything defined in util.go.
Running the binary build from the Default menu option from Ctrl Shift B works fine.