From b381748762f6478976bceac3b40c20c34c6b3097 Mon Sep 17 00:00:00 2001 From: Arcturus Date: Tue, 3 Aug 2021 12:30:26 +0800 Subject: [PATCH] enhance build.ps1 script (#15191) * enhance build.ps1 script * fix typo --- eng/scripts/build.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index 64a71dccb5b6..37bcc25e8402 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -1,5 +1,5 @@ #Requires -Version 7.0 -param([string]$filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild, [string]$config = "autorest.md", [string]$outputFolder) +param([string]$filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild, [switch]$format, [switch]$tidy, [string]$config = "autorest.md", [string]$outputFolder) . $PSScriptRoot/meta_generation.ps1 . $PSScriptRoot/get_module_dirs.ps1 @@ -34,6 +34,16 @@ function Process-Sdk ($path) { } } + if ($format) { + Write-Host "##[command]Executing gofmt -s -w . in " $path + gofmt -s -w $path + } + + if ($tidy) { + Write-Host "##[command]Executing go mod tidy in " $path + go mod tidy + } + if (!$skipBuild) { Write-Host "##[command]Executing go build -x -v ./... in " $path go build -x -v ./...