Friday, March 13, 2015

Go incursion on Windows - powershell

Today moved on Windows with the project and tried to address same folder limitation for go build (no luck: named files must all be in one directory; have blabla\ and blabla\someotherblabla\ )
$allGoFilesForBuildStringBuilder = New-Object -TypeName "System.Text.StringBuilder"
Get-ChildItem . -recurse | where { $_.extension -eq ".go" } | ForEach { $allGoFilesForBuildStringBuilder.Append('"').Append($_.FullName).Append('" ') } 
go build $allGoFilesForBuildStringBuilder.ToString()
Reminder: If you are stuck on GOROOT_BOOTSTRAP error, check that this env variable hints to a go folder having all the binaries in the bin subfolder.
[Environment]::SetEnvironmentVariable("GOROOT_BOOTSTRAP", "Go_Folder", "User")
[Environment]::GetEnvironmentVariable("GOROOT_BOOTSTRAP","User")
Use "Machine" instead of "User" for system wide configuration