diff --git a/autorest/adal/token.go b/autorest/adal/token.go index 1a9c8ab53..c90209a94 100644 --- a/autorest/adal/token.go +++ b/autorest/adal/token.go @@ -177,7 +177,7 @@ func (t Token) WillExpireIn(d time.Duration) bool { return !t.Expires().After(time.Now().Add(d)) } -//OAuthToken return the current access token +// OAuthToken return the current access token func (t *Token) OAuthToken() string { return t.AccessToken } diff --git a/autorest/autorest.go b/autorest/autorest.go index aafdf021f..211c98d1e 100644 --- a/autorest/autorest.go +++ b/autorest/autorest.go @@ -6,33 +6,33 @@ generated Go code. The package breaks sending and responding to HTTP requests into three phases: Preparing, Sending, and Responding. A typical pattern is: - req, err := Prepare(&http.Request{}, - token.WithAuthorization()) + req, err := Prepare(&http.Request{}, + token.WithAuthorization()) - resp, err := Send(req, - WithLogging(logger), - DoErrorIfStatusCode(http.StatusInternalServerError), - DoCloseIfError(), - DoRetryForAttempts(5, time.Second)) + resp, err := Send(req, + WithLogging(logger), + DoErrorIfStatusCode(http.StatusInternalServerError), + DoCloseIfError(), + DoRetryForAttempts(5, time.Second)) - err = Respond(resp, - ByDiscardingBody(), - ByClosing()) + err = Respond(resp, + ByDiscardingBody(), + ByClosing()) Each phase relies on decorators to modify and / or manage processing. Decorators may first modify and then pass the data along, pass the data first and then modify the result, or wrap themselves around passing the data (such as a logger might do). Decorators run in the order provided. For example, the following: - req, err := Prepare(&http.Request{}, - WithBaseURL("https://microsoft.com/"), - WithPath("a"), - WithPath("b"), - WithPath("c")) + req, err := Prepare(&http.Request{}, + WithBaseURL("https://microsoft.com/"), + WithPath("a"), + WithPath("b"), + WithPath("c")) will set the URL to: - https://microsoft.com/a/b/c + https://microsoft.com/a/b/c Preparers and Responders may be shared and re-used (assuming the underlying decorators support sharing and re-use). Performant use is obtained by creating one or more Preparers and Responders diff --git a/autorest/azure/auth/auth.go b/autorest/azure/auth/auth.go index 2f1a99818..e369f7c90 100644 --- a/autorest/azure/auth/auth.go +++ b/autorest/azure/auth/auth.go @@ -559,7 +559,7 @@ func NewDeviceFlowConfig(clientID string, tenantID string) DeviceFlowConfig { } } -//AuthorizerConfig provides an authorizer from the configuration provided. +// AuthorizerConfig provides an authorizer from the configuration provided. type AuthorizerConfig interface { Authorizer() (autorest.Authorizer, error) } diff --git a/autorest/azure/cli/token.go b/autorest/azure/cli/token.go index 486619111..056f6c342 100644 --- a/autorest/azure/cli/token.go +++ b/autorest/azure/cli/token.go @@ -47,7 +47,7 @@ type Token struct { const accessTokensJSON = "accessTokens.json" -// ToADALToken converts an Azure CLI `Token`` to an `adal.Token`` +// ToADALToken converts an Azure CLI `Token“ to an `adal.Token“ func (t Token) ToADALToken() (converted adal.Token, err error) { tokenExpirationDate, err := ParseExpirationDate(t.ExpiresOn) if err != nil { diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 388cae26a..14925b25b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,15 +9,12 @@ jobs: strategy: matrix: - Linux_Go115: - vm.image: 'ubuntu-18.04' - go.version: '1.15' - Linux_Go116: - vm.image: 'ubuntu-18.04' - go.version: '1.16' - Linux_Go117: - vm.image: 'ubuntu-18.04' - go.version: '1.17' + Linux_Go118: + vm.image: 'ubuntu-22.04' + go.version: '1.18.10' + Linux_Go119: + vm.image: 'ubuntu-22.04' + go.version: '1.19.5' current_go: 'true' pool: @@ -41,11 +38,11 @@ jobs: - script: | set -e export GO111MODULE=on - go get golang.org/x/lint/golint@latest - go get github.com/jstemmer/go-junit-report@latest - go get github.com/axw/gocov/gocov@latest - go get github.com/AlekSi/gocov-xml@latest - go get github.com/matm/gocov-html@latest + go install golang.org/x/lint/golint@latest + go install github.com/jstemmer/go-junit-report@latest + go install github.com/axw/gocov/gocov@latest + go install github.com/AlekSi/gocov-xml@latest + go install github.com/matm/gocov-html/cmd/gocov-html@latest workingDirectory: '$(sdkPath)' displayName: 'Install Dependencies'