Created
November 19, 2015 08:49
-
-
Save francoishill/318423cf69f62eadf4d1 to your computer and use it in GitHub Desktop.
A snippet to quickly generate a batch file to build/run a go app. In your folder with main.go, just create a new "run.bat" file and trigger this snippet by typing `run_go_app`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
@echo off | |
cls | |
SET ERRORLEVEL=0 | |
echo Running go build... ^ | |
& go build -o "${1:${TM_FILEPATH/.+\/(.+)\/.+\..+/$1/}}.exe"^ | |
& if errorlevel 1 goto ERROR | |
echo Running exe ${1}.exe... ^ | |
& ${1}.exe ^ | |
& if errorlevel 1 goto ERROR | |
goto SUCCESS | |
:SUCCESS | |
echo Success!! | |
goto EOF | |
:ERROR | |
echo ERROR!!! See the last ran command | |
pause | |
goto EOF | |
:EOF | |
]]></content> | |
<tabTrigger>run_go_app</tabTrigger> | |
<scope>source.dosbatch</scope> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment