Update CI to latest versions of Go (#67)

* Update CI to latest versions of Go

* switch to golangci-lint

* clean up lint

* switch to go install

* fix formatting
This commit is contained in:
Joel Hendrix 2022-12-05 15:11:49 -08:00 коммит произвёл GitHub
Родитель 383057ca6b
Коммит cbf23f4ad5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 21 добавлений и 19 удалений

Просмотреть файл

@ -76,15 +76,14 @@ func JWTProviderWithAzureEnvironment(env *azure.Environment) JWTProviderOption {
// JWTProviderWithEnvironmentVars configures the TokenProvider using the environment variables available
//
// 1. Client Credentials: attempt to authenticate with a Service Principal via "AZURE_TENANT_ID", "AZURE_CLIENT_ID" and
// "AZURE_CLIENT_SECRET"
// 1. Client Credentials: attempt to authenticate with a Service Principal via "AZURE_TENANT_ID", "AZURE_CLIENT_ID" and
// "AZURE_CLIENT_SECRET"
//
// 2. Client Certificate: attempt to authenticate with a Service Principal via "AZURE_TENANT_ID", "AZURE_CLIENT_ID",
// "AZURE_CERTIFICATE_PATH" and "AZURE_CERTIFICATE_PASSWORD"
// 2. Client Certificate: attempt to authenticate with a Service Principal via "AZURE_TENANT_ID", "AZURE_CLIENT_ID",
// "AZURE_CERTIFICATE_PATH" and "AZURE_CERTIFICATE_PASSWORD"
//
// 3. Managed Service Identity (MSI): attempt to authenticate via MSI
//
//
// The Azure Environment used can be specified using the name of the Azure Environment set in "AZURE_ENVIRONMENT" var.
func JWTProviderWithEnvironmentVars() JWTProviderOption {
return func(config *TokenProviderConfiguration) error {

Просмотреть файл

@ -9,12 +9,12 @@ jobs:
strategy:
matrix:
Linux_Go113:
vm.image: 'ubuntu-18.04'
go.version: '1.14.10'
Linux_Go114:
vm.image: 'ubuntu-18.04'
go.version: '1.15.3'
Linux_Go118:
vm.image: 'ubuntu-20.04'
go.version: '1.18.8'
Linux_Go119:
vm.image: 'ubuntu-20.04'
go.version: '1.19.3'
pool:
vmImage: '$(vm.image)'
@ -37,12 +37,11 @@ jobs:
- script: |
set -e
go get github.com/jstemmer/go-junit-report
go get github.com/axw/gocov/gocov
go get github.com/AlekSi/gocov-xml
go get -u github.com/matm/gocov-html
go get -u golang.org/x/lint/golint
go get github.com/fzipp/gocyclo/cmd/gocyclo
go install github.com/jstemmer/go-junit-report@v0.9.1
go install github.com/axw/gocov/gocov@v1.1.0
go install github.com/AlekSi/gocov-xml@v1.0.0
go install github.com/matm/gocov-html@v0.0.0-20200509184451-71874e2e203b
go install github.com/fzipp/gocyclo/cmd/gocyclo@v0.6.0
workingDirectory: '$(sdkPath)'
displayName: 'Install Dependencies'
@ -57,7 +56,9 @@ jobs:
displayName: 'Vet'
- script: |
golint ./...
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
golangci-lint --version
golangci-lint run
workingDirectory: '$(sdkPath)'
displayName: 'Lint'

Просмотреть файл

@ -58,7 +58,7 @@ type (
// TokenProviderWithEnvironmentVars creates a new SAS TokenProvider from environment variables
//
// There are two sets of environment variables which can produce a SAS TokenProvider
// # There are two sets of environment variables which can produce a SAS TokenProvider
//
// 1) Expected Environment Variables:
// - "EVENTHUB_KEY_NAME" the name of the Event Hub key

Просмотреть файл

@ -9,6 +9,7 @@ import (
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const (
@ -30,6 +31,7 @@ func TestNewSigner(t *testing.T) {
before := time.Now().UTC().Add(-2 * time.Second)
sigStr, expiry := signer.SignWithDuration("http://microsoft.com", 1*time.Hour)
nixExpiry, err := strconv.ParseInt(expiry, 10, 64)
require.NoError(t, err)
assert.WithinDuration(t, before.Add(1*time.Hour), time.Unix(nixExpiry, 0), 10*time.Second, "signing expiry")
sig, err := parseSig(sigStr)