...

Text file src/github.com/Azure/azure-sdk-for-go/eng/scripts/validate_go_mod.ps1

Documentation: github.com/Azure/azure-sdk-for-go/eng/scripts

     1Param(
     2    [string] $serviceDir
     3)
     4
     5. (Join-Path $PSScriptRoot .. common scripts common.ps1)
     6
     7Push-Location sdk/$serviceDir
     8
     9$goModFiles = Get-ChildItem -Path . -Filter go.mod -Recurse
    10
    11if ($goModFiles.Length -eq 0) {
    12    Write-Host "Could not find a go.mod file in the directory $(Get-Location)"
    13    exit 1
    14}
    15
    16$hasError = $false
    17foreach ($goMod in $goModFiles) {
    18    $mod = Get-GoModuleProperties ($goMod.Directory -replace ".*\/azure-sdk-for-go\/")
    19    if ($mod) {
    20        $name = $goMod.FullName
    21        $patternMatches = Get-Content $name | Select-String -Pattern "replace "
    22        if ($patternMatches.Length -ne 0) {
    23            Write-Host "Found a replace directive in go.mod file at $name"
    24            $hasError = $true
    25        } else {
    26            Write-Host "Valid go.mod file at $name"
    27        }
    28    }
    29}
    30
    31Pop-Location
    32
    33if ($hasError) {
    34    exit 1
    35}

View as plain text