Browse Source

Go on Windows

Pēteris Ņikiforovs 12 years ago
parent
commit
889624895d
6 changed files with 35 additions and 2 deletions
  1. 2 0
      README.md
  2. 2 0
      go/setup.bat
  3. 11 1
      go/setup.py
  4. 10 0
      installer.ps1
  5. 2 0
      webgo/setup.bat
  6. 8 1
      webgo/setup.py

+ 2 - 0
README.md

@@ -134,6 +134,7 @@ Note: The following tests are the only known tests to run on Windows
 * cake
 * express
 * express-mongodb
+* go
 * nodejs
 * nodejs-mongodb
 * express
@@ -151,6 +152,7 @@ Note: The following tests are the only known tests to run on Windows
 * micromvc
 * slim
 * phreeze
+* webgo
 
 Server installation scripts for Windows Server 2012 R2 on Amazon EC2.
 

+ 2 - 0
go/setup.bat

@@ -0,0 +1,2 @@
+set GOPATH=C:\FrameworkBenchmarks\go
+go run src\hello\hello.go

+ 11 - 1
go/setup.py

@@ -5,11 +5,21 @@ import setup_util
 
 def start(args):
   setup_util.replace_text("go/src/hello/hello.go", "tcp\(.*:3306\)", "tcp(" + args.database_host + ":3306)")
+  if os.name == 'nt':
+    #subprocess.call("rmdir /s /q pkg\\windows_amd64", shell=True, cwd="go")
+    #subprocess.call("rmdir /s /q src\\github.com", shell=True, cwd="go")
+    #subprocess.call("del /s /q /f bin\\hello.exe", shell=True, cwd="go")
+    subprocess.call("set GOPATH=C:\\FrameworkBenchmarks\\go&& go get ./...", shell=True, cwd="go")
+    subprocess.Popen("setup.bat", shell=True, cwd="go") 
+    return 0
   subprocess.call("go get ./...", shell=True, cwd="go") 
   subprocess.Popen("go run src/hello/hello.go".rsplit(" "), cwd="go")
   return 0
 def stop():
-  
+  if os.name == 'nt':
+    subprocess.call("taskkill /f /im go.exe > NUL", shell=True)
+    subprocess.call("taskkill /f /im hello.exe > NUL", shell=True)
+    return 0
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():

+ 10 - 0
installer.ps1

@@ -125,6 +125,16 @@ $composer_local = "$workdir\Composer-Setup.exe"
 Start-Process $composer_local "/silent" -Wait
 $env:Path += ";C:\ProgramData\Composer\bin"; [Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Machine)
 
+#
+# Go
+#
+Write-Host "Installing Go...`n"
+$go_url = "https://go.googlecode.com/files/go1.1rc3.windows-amd64.msi"
+$go_local = "$workdir\go1.1rc3.windows-amd64.msi"
+(New-Object System.Net.WebClient).DownloadFile($go_url, $go_local)
+Start-Process $go_local "/passive" -Wait
+$env:Path += ";C:\Go\bin"; [Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Machine)
+
 #
 # Firewall
 #

+ 2 - 0
webgo/setup.bat

@@ -0,0 +1,2 @@
+set GOPATH=C:\FrameworkBenchmarks\webgo
+go run src\hello\hello.go

+ 8 - 1
webgo/setup.py

@@ -4,11 +4,18 @@ import sys
 import os
 
 def start(args):
+  if os.name == 'nt':
+    subprocess.call("set GOPATH=C:\\FrameworkBenchmarks\\webgo&&go get ./...", shell=True, cwd="webgo")
+    subprocess.Popen("setup.bat", shell=True, cwd="webgo") 
+    return 0
   subprocess.call("go get ./...", shell=True, cwd="webgo")
   subprocess.Popen("go run src/hello/hello.go".rsplit(" "), cwd="webgo")
   return 0
 def stop():
-  
+  if os.name == 'nt':
+    subprocess.call("taskkill /f /im go.exe > NUL", shell=True)
+    subprocess.call("taskkill /f /im hello.exe > NUL", shell=True)
+    return 0
   p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
   out, err = p.communicate()
   for line in out.splitlines():