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 30 31 32 33 34 35
|
Param(
[string] $serviceDir
)
. (Join-Path $PSScriptRoot .. common scripts common.ps1)
Push-Location sdk/$serviceDir
$goModFiles = Get-ChildItem -Path . -Filter go.mod -Recurse
if ($goModFiles.Length -eq 0) {
Write-Host "Could not find a go.mod file in the directory $(Get-Location)"
exit 1
}
$hasError = $false
foreach ($goMod in $goModFiles) {
$mod = Get-GoModuleProperties ($goMod.Directory -replace ".*\/azure-sdk-for-go\/")
if ($mod) {
$name = $goMod.FullName
$patternMatches = Get-Content $name | Select-String -Pattern "replace "
if ($patternMatches.Length -ne 0) {
Write-Host "Found a replace directive in go.mod file at $name"
$hasError = $true
} else {
Write-Host "Valid go.mod file at $name"
}
}
}
Pop-Location
if ($hasError) {
exit 1
}
|