File: create_go_workspace.ps1

package info (click to toggle)
golang-github-azure-azure-sdk-for-go 68.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556,256 kB
  • sloc: javascript: 196; sh: 96; makefile: 7
file content (29 lines) | stat: -rw-r--r-- 1,174 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Intended to be used at the beginning of CI process to easily encapsulate the work of creating a new Go workspace.

# On completion. Returns two variables in a PSObject. 
#  GO_WORKSPACE_PATH <- location of copied sources directory
#  GO_PATH <- The value that should be set for the GO_PATH environment variable
Param(
    [string] $goWorkSpaceDir,
    [string] $orgOrUser = "Azure",
    [string] $repo = "azure-sdk-for-go"
)
$repoRoot = Resolve-Path "$PSScriptRoot/../../"

$CreatedGoWorkspaceSrc = "$goWorkSpaceDir/src/github.com/$orgOrUser/$repo/"
$CreatedGoWorkspacePkg = "$goWorkSpaceDir/pkg"

# create base two folders for the root of the go workspace
New-Item -ItemType Directory -Force -Path $CreatedGoWorkspaceSrc
New-Item -ItemType Directory -Force -Path $CreatedGoWorkspacePkg

Write-Host "Source is $repoRoot"
Write-Host "Destination is $CreatedGoWorkspaceSrc"
Write-Host "Root of new Go Workspace is $goWorkSpaceDir"

Copy-Item -Container -Recurse -Path "$repoRoot/*" -Destination $CreatedGoWorkspaceSrc

return New-Object PSObject -Property @{
    GO_WORKSPACE_PATH = Resolve-Path $CreatedGoWorkspaceSrc
    GO_PATH           = Resolve-Path $goWorkSpaceDir
}