Skip to content

Instantly share code, notes, and snippets.

@jegor377
Created November 12, 2016 01:35
Show Gist options
  • Save jegor377/104f3a518727747cd4a4f40e61fcd67c to your computer and use it in GitHub Desktop.
Save jegor377/104f3a518727747cd4a4f40e61fcd67c to your computer and use it in GitHub Desktop.
if %1.go.==. goto :errorFileName
echo package %1>>%1.go
echo.>>%1.go
echo import "fmt">>%1.go
echo.>>%1.go
echo func main() {>>%1.go
echo fmt.Println("Hello World\n")>>%1.go
echo }>>%1.go
exit /b
:errorFileName
echo You didn't type file name.
exit /b
@echo off
if %1.==. goto :errorProjectName
set goProjectsDir=D:\Dane\Projekty\Go
set projectPath=%cd%\%1Code
mkdir %projectPath%
set GOPATH=%projectPath%
cd /d %projectPath%
mkdir %projectPath%\src
cd %projectPath%\src
mkdir %1
cd %1
createGoFile.bat main
exit /b
:errorProjectName
echo You didn't type project name.
exit /b
@echo off
set GOPATH=%cd%
@echo off
if %1.==. goto :errorPackageName
set packagePath=%GOPATH%\src\%1
mkdir %packagePath%
pushd %packagePath%
createGoFile.bat %1
popd
exit /b
:errorPackageName
echo You didn't type package name.
exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment