Skip to content

Commit

Permalink
chore: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Sep 7, 2022
1 parent cc5d770 commit 3632a6c
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 22 deletions.
1 change: 1 addition & 0 deletions cmd/cmd_create_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ To encrypt an auto-generated OAuth2 Client Secret, use flags `+"`--pgp-key`"+`,
}

secret := flagx.MustGetString(cmd, flagClientSecret)
//nolint:bodyclose
client, _, err := m.AdminApi.CreateOAuth2Client(cmd.Context()).OAuth2Client(clientFromFlags(cmd)).Execute()
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
Expand Down
9 changes: 1 addition & 8 deletions cmd/cmd_create_jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func NewCreateJWKSCmd(parent *cobra.Command) *cobra.Command {
kid = args[1]
}

//nolint:bodyclose
jwks, _, err := m.AdminApi.CreateJsonWebKeySet(context.Background(), args[0]).JsonWebKeySetGeneratorRequest(hydra.JsonWebKeySetGeneratorRequest{
Alg: flagx.MustGetString(cmd, alg),
Kid: kid,
Expand All @@ -61,14 +62,6 @@ func NewCreateJWKSCmd(parent *cobra.Command) *cobra.Command {
return cmdx.PrintOpenAPIError(cmd, err)
}

var output []outputJsonWebKey
for _, key := range jwks.Keys {
output = append(output, outputJsonWebKey{
Set: args[0],
JSONWebKey: key,
})
}

cmdx.PrintTable(cmd, &outputJSONWebKeyCollection{Keys: jwks.Keys, Set: args[0]})
return nil
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_delete_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To delete OAuth 2.0 Clients with the owner of "foo@bar.com", run:
)

for _, c := range args {
_, err := m.AdminApi.DeleteOAuth2Client(cmd.Context(), c).Execute()
_, err := m.AdminApi.DeleteOAuth2Client(cmd.Context(), c).Execute() //nolint:bodyclose
if err != nil {
failed[c] = cmdx.PrintOpenAPIError(cmd, err)
continue
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_delete_jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewDeleteJWKSCommand(root *cobra.Command) *cobra.Command {
)

for _, c := range args {
_, err = m.AdminApi.DeleteJsonWebKeySet(context.Background(), c).Execute()
_, err = m.AdminApi.DeleteJsonWebKeySet(context.Background(), c).Execute() //nolint:bodyclose
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_delete_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewDeleteAccessTokensCmd(parent *cobra.Command) *cobra.Command {
}

clientID := args[0]
_, err = client.AdminApi.DeleteOAuth2Token(cmd.Context()).ClientId(clientID).Execute()
_, err = client.AdminApi.DeleteOAuth2Token(cmd.Context()).ClientId(clientID).Execute() //nolint:bodyclose
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/cmd_get_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewGetClientsCmd(root *cobra.Command) *cobra.Command {
Use: "client id-1 [id-2] [id-n]",
Args: cobra.MinimumNArgs(1),
Short: "Get one or more OAuth 2.0 Clients by their ID(s)",
Long: fmt.Sprintf(`This command gets all the details about an OAuth 2.0 Client. You can use this command in combination with jq.`),
Long: `This command gets all the details about an OAuth 2.0 Client. You can use this command in combination with jq.`,
Example: fmt.Sprintf(`To get the OAuth 2.0 Client's secret, run:
%s get client <your-client-id> | jq -r '.client_secret'`, root.Use),
Expand All @@ -47,7 +47,7 @@ func NewGetClientsCmd(root *cobra.Command) *cobra.Command {

clients := make([]hydra.OAuth2Client, 0, len(args))
for _, id := range args {
client, _, err := m.AdminApi.GetOAuth2Client(cmd.Context(), id).Execute()
client, _, err := m.AdminApi.GetOAuth2Client(cmd.Context(), id).Execute() //nolint:bodyclose
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/cmd_get_jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewGetJWKSCmd(root *cobra.Command) *cobra.Command {
Use: "jwks set-1",
Args: cobra.ExactArgs(1),
Short: "Get a JSON Web Key Set by its ID(s)",
Long: fmt.Sprintf(`This command gets all the details about an JSON Web Key. You can use this command in combination with jq.`),
Long: `This command gets all the details about an JSON Web Key. You can use this command in combination with jq.`,
Example: fmt.Sprintf(`To get the JSON Web Key Set's secret, run:
%s get jwks <set-id> | jq -r '.[].use'`, root.Use),
Expand All @@ -46,7 +46,7 @@ func NewGetJWKSCmd(root *cobra.Command) *cobra.Command {

var sets outputJSONWebKeyCollection
for _, set := range args {
key, _, err := m.AdminApi.GetJsonWebKeySet(cmd.Context(), set).Execute()
key, _, err := m.AdminApi.GetJsonWebKeySet(cmd.Context(), set).Execute() //nolint:bodyclose
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_import_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Please be aware that this command does not update existing clients. If the clien

for src, cc := range clients {
for _, c := range cc {
result, _, err := m.AdminApi.CreateOAuth2Client(cmd.Context()).OAuth2Client(c).Execute()
result, _, err := m.AdminApi.CreateOAuth2Client(cmd.Context()).OAuth2Client(c).Execute() //nolint:bodyclose
if err != nil {
failed[src] = cmdx.PrintOpenAPIError(cmd, err)
continue
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_import_jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ the imported keys will be added to that set. Otherwise, a new set will be create
failed := make(map[string]error)
for src, kk := range keys {
for _, k := range kk {
result, _, err := m.AdminApi.UpdateJsonWebKey(cmd.Context(), k.Kid, set).JSONWebKey(k).Execute()
result, _, err := m.AdminApi.UpdateJsonWebKey(cmd.Context(), k.Kid, set).JSONWebKey(k).Execute() //nolint:bodyclose
if err != nil {
failed[src] = cmdx.PrintOpenAPIError(cmd, err)
continue
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_introspect_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewIntrospectTokenCmd(parent *cobra.Command) *cobra.Command {

result, _, err := client.AdminApi.IntrospectOAuth2Token(cmd.Context()).
Token(args[0]).
Scope(strings.Join(flagx.MustGetStringSlice(cmd, "scope"), " ")).Execute()
Scope(strings.Join(flagx.MustGetStringSlice(cmd, "scope"), " ")).Execute() //nolint:bodyclose
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/cmd_perform_authorization_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ import (
"crypto/rsa"
"crypto/tls"
"fmt"
"github.com/pkg/errors"
"html/template"
"net/http"
"os"
"strconv"
"strings"
"time"

"github.com/pkg/errors"

"github.com/ory/graceful"

"github.com/julienschmidt/httprouter"
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_revoke_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Please provide a Client ID and Client Secret using flags --client-id and --clien
context.WithValue(cmd.Context(), hydra.ContextBasicAuth, hydra.BasicAuth{
UserName: clientID,
Password: clientSecret,
})).Token(token).Execute()
})).Token(token).Execute() //nolint:bodyclose
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_update_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To encrypt an auto-generated OAuth2 Client Secret, use flags `+"`--pgp-key`"+`,
id := args[0]
cc := clientFromFlags(cmd)

client, _, err := m.AdminApi.UpdateOAuth2Client(context.Background(), id).OAuth2Client(cc).Execute()
client, _, err := m.AdminApi.UpdateOAuth2Client(context.Background(), id).OAuth2Client(cc).Execute() //nolint:bodyclose
if err != nil {
return cmdx.PrintOpenAPIError(cmd, err)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/output_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package cmd

import (
"fmt"
"github.com/ory/x/stringsx"
"time"

"github.com/ory/x/stringsx"

"golang.org/x/oauth2"
)

Expand Down

0 comments on commit 3632a6c

Please sign in to comment.