Skip to content

Commit

Permalink
fix failing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOHart committed Sep 26, 2024
1 parent c0ba80f commit edbd6d6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions apps/confidential/confidential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (

// errorClient is an HTTP client for tests that should fail when confidential.Client sends a request
type errorClient struct{}
type contextKey struct{}

func (*errorClient) Do(req *http.Request) (*http.Response, error) {
return nil, fmt.Errorf("expected no requests but received one for %s", req.URL.String())
Expand Down Expand Up @@ -212,7 +213,7 @@ func TestAcquireTokenOnBehalfOf(t *testing.T) {

func TestAcquireTokenByAssertionCallback(t *testing.T) {
calls := 0
key := struct{}{}
key := contextKey{}
ctx := context.WithValue(context.Background(), key, true)
getAssertion := func(c context.Context, o AssertionRequestOptions) (string, error) {
if v := c.Value(key); v == nil || !v.(bool) {
Expand Down Expand Up @@ -631,7 +632,7 @@ func TestNewCredFromTokenProvider(t *testing.T) {
expectedToken := "expected token"
called := false
expiresIn := 4200
key := struct{}{}
key := contextKey{}
ctx := context.WithValue(context.Background(), key, true)
cred := NewCredFromTokenProvider(func(c context.Context, tp exported.TokenProviderParameters) (exported.TokenProviderResult, error) {
if called {
Expand Down Expand Up @@ -887,7 +888,7 @@ func TestWithClaims(t *testing.T) {
case "obo":
ar, err = client.AcquireTokenOnBehalfOf(ctx, "assertion", tokenScope, WithClaims(test.claims))
default:
t.Fatalf("test bug: no test for " + method)
t.Fatalf("test bug: no test for %s", method)
}
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -997,7 +998,7 @@ func TestWithTenantID(t *testing.T) {
case "obo":
ar, err = client.AcquireTokenOnBehalfOf(ctx, "assertion", tokenScope, WithTenantID(test.tenant))
default:
t.Fatalf("test bug: no test for " + method)
t.Fatalf("test bug: no test for %s", method)
}
if err != nil {
if test.expectError {
Expand Down
2 changes: 1 addition & 1 deletion apps/internal/base/internal/storage/items_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func TestContractUnmarshalJSON(t *testing.T) {
}
if diff := pretty.Compare(want, got); diff != "" {
t.Errorf("TestContractUnmarshalJSON: -want/+got:\n%s", diff)
t.Errorf(string(got.AdditionalFields["unknownEntity"].(stdJSON.RawMessage)))
t.Errorf("%s", string(got.AdditionalFields["unknownEntity"].(stdJSON.RawMessage)))
}
}

Expand Down
3 changes: 2 additions & 1 deletion apps/internal/local/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ func (s *Server) handler(w http.ResponseWriter, r *http.Request) {
// Note: It is a little weird we handle some errors by not going to the failPage. If they all should,
// change this to s.error() and make s.error() write the failPage instead of an error code.
_, _ = w.Write([]byte(fmt.Sprintf(failPage, headerErr, desc)))
s.putResult(Result{Err: fmt.Errorf(desc)})
s.putResult(Result{Err: fmt.Errorf("%s", desc)})

return
}

Expand Down
2 changes: 1 addition & 1 deletion apps/managedidentity/managedidentity.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func SystemAssigned() ID {
type Client struct {
httpClient ops.HTTPClient
miType ID
source Source
// source Source reenable when required in future sources
}

type ClientOptions struct {
Expand Down
6 changes: 3 additions & 3 deletions apps/public/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func TestAcquireTokenWithTenantID(t *testing.T) {
case "password":
ar, err = client.AcquireTokenByUsernamePassword(ctx, tokenScope, "username", "password", WithTenantID(test.tenant))
default:
t.Fatalf("test bug: no test for " + method)
t.Fatalf("test bug: no test for %s", method)
}
if err != nil {
if test.expectError {
Expand Down Expand Up @@ -620,7 +620,7 @@ func TestWithClaims(t *testing.T) {
client.base.Token.WSTrust = fake.WSTrust{SamlTokenInfo: wstrust.SamlTokenInfo{AssertionType: "urn:ietf:params:oauth:grant-type:saml1_1-bearer"}}
ar, err = client.AcquireTokenByUsernamePassword(ctx, tokenScope, "username", "password", WithClaims(test.claims))
default:
t.Fatalf("test bug: no test for " + method)
t.Fatalf("test bug: no test for %s", method)
}
if method == "devicecode" && err == nil {
// complete the device code flow
Expand Down Expand Up @@ -910,7 +910,7 @@ func TestWithAuthenticationScheme(t *testing.T) {
case "password":
ar, err = client.AcquireTokenByUsernamePassword(ctx, tokenScope, "username", "password", WithAuthenticationScheme(authScheme))
default:
t.Fatalf("test bug: no test for " + testCase.name)
t.Fatalf("test bug: no test for %s", testCase.name)
}

// validate that the token is created correctly
Expand Down
2 changes: 1 addition & 1 deletion apps/tests/devapps/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

var (
config = CreateConfig("config.json")
//config = CreateConfig("config.json") reenable when config is implemented
cacheAccessor = &TokenCache{file: "serialized_cache.json"}
)

Expand Down

0 comments on commit edbd6d6

Please sign in to comment.