...
1# Intended to be used at the beginning of CI process to easily encapsulate the work of creating a new Go workspace.
2
3# On completion. Returns two variables in a PSObject.
4# GO_WORKSPACE_PATH <- location of copied sources directory
5# GO_PATH <- The value that should be set for the GO_PATH environment variable
6Param(
7 [string] $goWorkSpaceDir,
8 [string] $orgOrUser = "Azure",
9 [string] $repo = "azure-sdk-for-go"
10)
11$repoRoot = Resolve-Path "$PSScriptRoot/../../"
12
13$CreatedGoWorkspaceSrc = "$goWorkSpaceDir/src/github.com/$orgOrUser/$repo/"
14$CreatedGoWorkspacePkg = "$goWorkSpaceDir/pkg"
15
16# create base two folders for the root of the go workspace
17New-Item -ItemType Directory -Force -Path $CreatedGoWorkspaceSrc
18New-Item -ItemType Directory -Force -Path $CreatedGoWorkspacePkg
19
20Write-Host "Source is $repoRoot"
21Write-Host "Destination is $CreatedGoWorkspaceSrc"
22Write-Host "Root of new Go Workspace is $goWorkSpaceDir"
23
24Copy-Item -Container -Recurse -Path "$repoRoot/*" -Destination $CreatedGoWorkspaceSrc
25
26return New-Object PSObject -Property @{
27 GO_WORKSPACE_PATH = Resolve-Path $CreatedGoWorkspaceSrc
28 GO_PATH = Resolve-Path $goWorkSpaceDir
29}
View as plain text