diff --git a/Makefile b/Makefile index dc437abe11e2..67f5ff24d3f8 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ docs/swagger: npx @redocly/openapi-cli preview-docs spec/swagger.json .bin/golangci-lint: Makefile - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -d -b .bin v1.47.3 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -d -b .bin v1.50.1 .bin/hydra: Makefile bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) -d -b .bin hydra v2.0.2 diff --git a/cmd/identities/definitions.go b/cmd/identities/definitions.go index c04750d93004..9f2cafb12775 100644 --- a/cmd/identities/definitions.go +++ b/cmd/identities/definitions.go @@ -18,7 +18,7 @@ type ( } ) -func (_ outputIdentity) Header() []string { +func (outputIdentity) Header() []string { return []string{"ID", "VERIFIED ADDRESSES", "RECOVERY ADDRESSES", "SCHEMA ID", "SCHEMA URL"} } @@ -56,7 +56,7 @@ func (i outputIdentity) Interface() interface{} { return i } -func (_ outputIdentityCollection) Header() []string { +func (outputIdentityCollection) Header() []string { return outputIdentity{}.Header() } diff --git a/courier/courier_test.go b/courier/courier_test.go index cc72b69ad8b5..15c5ec783474 100644 --- a/courier/courier_test.go +++ b/courier/courier_test.go @@ -10,7 +10,6 @@ import ( dhelper "github.com/ory/x/sqlcon/dockertest" ) -// nolint:staticcheck func TestMain(m *testing.M) { atexit := dhelper.NewOnExit() atexit.Add(x.CleanUpTestSMTP) diff --git a/courier/handler.go b/courier/handler.go index 65222996e552..d10a9dc0209f 100644 --- a/courier/handler.go +++ b/courier/handler.go @@ -57,7 +57,9 @@ func (h *Handler) RegisterAdminRoutes(admin *x.RouterAdmin) { // Paginated Courier Message List Response // // swagger:response listCourierMessages -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listCourierMessagesResponse struct { migrationpagination.ResponseHeaderAnnotation @@ -157,7 +159,9 @@ func parseMessagesFilter(r *http.Request) (ListCourierMessagesParameters, []keys // Get Courier Message Parameters // // swagger:parameters getCourierMessage -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getCourierMessage struct { // MessageID is the ID of the message. // diff --git a/driver/config/config_test.go b/driver/config/config_test.go index 1b8108a0d160..9832dc955b19 100644 --- a/driver/config/config_test.go +++ b/driver/config/config_test.go @@ -396,19 +396,6 @@ func TestViperProvider(t *testing.T) { }) } -type InterceptHook struct { - lastEntry *logrus.Entry -} - -func (l InterceptHook) Levels() []logrus.Level { - return []logrus.Level{logrus.FatalLevel} -} - -func (l InterceptHook) Fire(e *logrus.Entry) error { - l.lastEntry = e - return nil -} - func TestBcrypt(t *testing.T) { ctx := context.Background() p := config.MustNew(t, logrusx.New("", ""), os.Stderr, configx.SkipValidation()) @@ -684,7 +671,7 @@ func TestViperProvider_DSN(t *testing.T) { var exitCode int l := logrusx.New("", "", logrusx.WithExitFunc(func(i int) { exitCode = i - }), logrusx.WithHook(InterceptHook{})) + })) p := config.MustNew(t, l, os.Stderr, configx.SkipValidation()) assert.Equal(t, dsn, p.DSN(ctx)) diff --git a/go.mod b/go.mod index ca61573c4ab9..683eac4660ee 100644 --- a/go.mod +++ b/go.mod @@ -53,7 +53,7 @@ require ( github.com/google/uuid v1.3.0 github.com/gorilla/sessions v1.2.1 github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69 - github.com/hashicorp/consul/api v1.12.0 + github.com/hashicorp/consul/api v1.18.0 github.com/hashicorp/go-retryablehttp v0.7.1 github.com/hashicorp/golang-lru v0.5.4 github.com/imdario/mergo v0.3.13 @@ -70,14 +70,14 @@ require ( github.com/ory/analytics-go/v4 v4.0.3 github.com/ory/client-go v0.2.0-alpha.60 github.com/ory/dockertest/v3 v3.9.1 - github.com/ory/go-acc v0.2.8 + github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe github.com/ory/graceful v0.1.3 github.com/ory/herodot v0.9.13 github.com/ory/hydra-client-go v1.11.9-0.20221102130300-f558e85344c8 github.com/ory/jsonschema/v3 v3.0.7 github.com/ory/mail/v3 v3.0.0 github.com/ory/nosurf v1.2.7 - github.com/ory/x v0.0.533-0.20230116223630-aebae0b3a8a1 + github.com/ory/x v0.0.534 github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/pkg/errors v0.9.1 github.com/pquerna/otp v1.4.0 @@ -100,11 +100,12 @@ require ( golang.org/x/net v0.5.0 golang.org/x/oauth2 v0.4.0 golang.org/x/sync v0.1.0 - golang.org/x/tools v0.4.0 + golang.org/x/tools v0.5.0 ) require ( - cloud.google.com/go/compute v1.7.0 // indirect + cloud.google.com/go/compute v1.14.0 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect @@ -114,7 +115,7 @@ require ( github.com/a8m/envsubst v1.3.0 // indirect github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 // indirect - github.com/armon/go-metrics v0.3.10 // indirect + github.com/armon/go-metrics v0.4.0 // indirect github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect github.com/avast/retry-go/v4 v4.3.0 // indirect github.com/aymerick/douceur v0.2.0 // indirect @@ -199,7 +200,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hashicorp/serf v0.9.7 // indirect + github.com/hashicorp/serf v0.10.1 // indirect github.com/huandu/xstrings v1.3.2 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect @@ -246,10 +247,8 @@ require ( github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/opencontainers/runc v1.1.4 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect - github.com/ory/viper v1.7.5 // indirect - github.com/pborman/uuid v1.2.1 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.1 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pkg/profile v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pquerna/cachecontrol v0.1.0 // indirect @@ -271,8 +270,8 @@ require ( github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/viper v1.12.0 // indirect - github.com/subosito/gotenv v1.4.1 // indirect + github.com/spf13/viper v1.15.0 // indirect + github.com/subosito/gotenv v1.4.2 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/timtadh/data-structures v0.5.3 // indirect @@ -287,10 +286,10 @@ require ( github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect go.etcd.io/bbolt v1.3.5 // indirect - go.etcd.io/etcd/api/v3 v3.5.4 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect - go.etcd.io/etcd/client/v2 v2.305.4 // indirect - go.etcd.io/etcd/client/v3 v3.5.4 // indirect + go.etcd.io/etcd/api/v3 v3.5.6 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.5.6 // indirect + go.etcd.io/etcd/client/v2 v2.305.6 // indirect + go.etcd.io/etcd/client/v3 v3.5.6 // indirect go.etcd.io/etcd/etcdctl/v3 v3.5.0-alpha.0 // indirect go.etcd.io/etcd/pkg/v3 v3.5.0-alpha.0 // indirect go.etcd.io/etcd/raft/v3 v3.5.0-alpha.0 // indirect @@ -311,8 +310,8 @@ require ( go.opentelemetry.io/otel/sdk v1.11.1 // indirect go.opentelemetry.io/proto/otlp v0.18.0 // indirect go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.7.0 // indirect - go.uber.org/zap v1.17.0 // indirect + go.uber.org/multierr v1.8.0 // indirect + go.uber.org/zap v1.21.0 // indirect golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect golang.org/x/mod v0.7.0 // indirect golang.org/x/sys v0.4.0 // indirect @@ -321,8 +320,8 @@ require ( golang.org/x/time v0.1.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71 // indirect - google.golang.org/grpc v1.50.1 // indirect + google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect + google.golang.org/grpc v1.52.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect diff --git a/identity/handler.go b/identity/handler.go index 2a1788c1ee9a..459bd00e355d 100644 --- a/identity/handler.go +++ b/identity/handler.go @@ -106,7 +106,9 @@ func (h *Handler) RegisterAdminRoutes(admin *x.RouterAdmin) { // Paginated Identity List Response // // swagger:response listIdentities -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listIdentitiesResponse struct { migrationpagination.ResponseHeaderAnnotation @@ -119,7 +121,9 @@ type listIdentitiesResponse struct { // Paginated List Identity Parameters // // swagger:parameters listIdentities -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listIdentitiesParameters struct { migrationpagination.RequestParameters } @@ -168,7 +172,9 @@ func (h *Handler) list(w http.ResponseWriter, r *http.Request, _ httprouter.Para // Get Identity Parameters // // swagger:parameters getIdentity -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getIdentity struct { // ID must be set to the ID of identity you want to get // @@ -235,7 +241,9 @@ func (h *Handler) get(w http.ResponseWriter, r *http.Request, ps httprouter.Para // Create Identity Parameters // // swagger:parameters createIdentity -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createIdentity struct { // in: body Body CreateIdentityBody @@ -425,7 +433,9 @@ func (h *Handler) create(w http.ResponseWriter, r *http.Request, _ httprouter.Pa // Update Identity Parameters // // swagger:parameters updateIdentity -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateIdentity struct { // ID must be set to the ID of identity you want to update // @@ -556,7 +566,9 @@ func (h *Handler) update(w http.ResponseWriter, r *http.Request, ps httprouter.P // Delete Identity Parameters // // swagger:parameters deleteIdentity -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type deleteIdentity struct { // ID is the identity's ID. // @@ -597,7 +609,9 @@ func (h *Handler) delete(w http.ResponseWriter, r *http.Request, ps httprouter.P // Patch Identity Parameters // // swagger:parameters patchIdentity -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type patchIdentity struct { // ID must be set to the ID of identity you want to update // diff --git a/identity/handler_test.go b/identity/handler_test.go index b9dddff130f7..5713c133379b 100644 --- a/identity/handler_test.go +++ b/identity/handler_test.go @@ -99,17 +99,6 @@ func TestHandler(t *testing.T) { type patch map[string]interface{} - var makePatch = func(t *testing.T, patches ...patch) []patch { - t.Helper() - result := make([]patch, 0, len(patches)) - - for _, patch := range patches { - result = append(result, patch) - } - - return result - } - t.Run("case=should return an empty list", func(t *testing.T) { for name, ts := range map[string]*httptest.Server{"public": publicTS, "admin": adminTS} { t.Run("endpoint="+name, func(t *testing.T) { @@ -542,11 +531,11 @@ func TestHandler(t *testing.T) { for name, ts := range map[string]*httptest.Server{"public": publicTS, "admin": adminTS} { t.Run("endpoint="+name, func(t *testing.T) { - ur := makePatch(t, patch{ - "op": "replace", "path": "/state", "value": identity.StateInactive, - }) + patch := []patch{ + {"op": "replace", "path": "/state", "value": identity.StateInactive}, + } - res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusOK, &ur) + res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusOK, &patch) assert.EqualValues(t, uuid, res.Get("traits.subject").String(), "%s", res.Raw) assert.False(t, res.Get("metadata_admin.admin").Exists(), "%s", res.Raw) assert.False(t, res.Get("metadata_public.public").Exists(), "%s", res.Raw) @@ -571,11 +560,11 @@ func TestHandler(t *testing.T) { for name, ts := range map[string]*httptest.Server{"public": publicTS, "admin": adminTS} { t.Run("endpoint="+name, func(t *testing.T) { - ur := makePatch(t, patch{ - "op": "replace", "path": "/schema_id", "value": "invalid-id", - }) + patch := []patch{ + {"op": "replace", "path": "/schema_id", "value": "invalid-id"}, + } - res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusBadRequest, &ur) + res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusBadRequest, &patch) assert.Contains(t, res.Get("error.reason").String(), "invalid-id", "%s", res.Raw) res = get(t, ts, "/identities/"+i.ID.String(), http.StatusOK) @@ -596,9 +585,11 @@ func TestHandler(t *testing.T) { for name, ts := range map[string]*httptest.Server{"public": publicTS, "admin": adminTS} { t.Run("endpoint="+name, func(t *testing.T) { - ur := makePatch(t, patch{"op": "replace", "path": "/state", "value": "invalid-value"}) + patch := []patch{ + {"op": "replace", "path": "/state", "value": "invalid-value"}, + } - res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusBadRequest, &ur) + res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusBadRequest, &patch) assert.EqualValues(t, "identity state is not valid", res.Get("error.reason").String(), "%s", res.Raw) res = get(t, ts, "/identities/"+i.ID.String(), http.StatusOK) @@ -619,9 +610,11 @@ func TestHandler(t *testing.T) { for name, ts := range map[string]*httptest.Server{"public": publicTS, "admin": adminTS} { t.Run("endpoint="+name, func(t *testing.T) { - ur := makePatch(t, patch{"op": "replace", "path": "/traits/subject", "value": "patched-subject"}) + patch := []patch{ + {"op": "replace", "path": "/traits/subject", "value": "patched-subject"}, + } - res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusOK, &ur) + res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusOK, &patch) assert.EqualValues(t, "patched-subject", res.Get("traits.subject").String(), "%s", res.Raw) res = get(t, ts, "/identities/"+i.ID.String(), http.StatusOK) @@ -649,9 +642,11 @@ func TestHandler(t *testing.T) { for name, ts := range map[string]*httptest.Server{"public": publicTS, "admin": adminTS} { t.Run("endpoint="+name, func(t *testing.T) { - ur := makePatch(t, patch{"op": "replace", "path": "/credentials", "value": "patched-credentials"}) + patch := []patch{ + {"op": "replace", "path": "/credentials", "value": "patched-credentials"}, + } - res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusBadRequest, &ur) + res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusBadRequest, &patch) assert.EqualValues(t, "patch includes denied path: /credentials", res.Get("error.reason").String(), "%s", res.Raw) }) @@ -690,13 +685,11 @@ func TestHandler(t *testing.T) { loginResponse := testhelpers.SubmitLoginForm(t, true, ts.Client(), ts, values, false, true, 200, "") require.NotEmpty(t, gjson.Get(loginResponse, "session_token").String(), "expected to find a session token, found none") - ur := makePatch(t, patch{ - "op": "replace", "path": "/metadata_public", "value": map[string]string{ - "role": "user", - }, - }) + patch := []patch{ + {"op": "replace", "path": "/metadata_public", "value": map[string]string{"role": "user"}}, + } - res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusOK, &ur) + res := send(t, ts, "PATCH", "/identities/"+i.ID.String(), http.StatusOK, &patch) assert.EqualValues(t, "user", res.Get("metadata_public.role").String(), "%s", res.Raw) assert.NotEqualValues(t, i.StateChangedAt, sqlxx.NullTime(res.Get("state_changed_at").Time()), "%s", res.Raw) @@ -908,12 +901,12 @@ func TestHandler(t *testing.T) { res := send(t, ts, "POST", "/identities", http.StatusCreated, &cr) id := res.Get("id").String() - res = send(t, ts, "PUT", "/identities/"+id, http.StatusOK, &identity.UpdateIdentityBody{ + _ = send(t, ts, "PUT", "/identities/"+id, http.StatusOK, &identity.UpdateIdentityBody{ SchemaID: "employee", Traits: []byte(`{"email":"` + x.NewUUID().String() + `@ory.sh"}`), }) - res = send(t, ts, "PUT", "/identities/"+id, http.StatusOK, &identity.UpdateIdentityBody{ + _ = send(t, ts, "PUT", "/identities/"+id, http.StatusOK, &identity.UpdateIdentityBody{ SchemaID: "employee", Traits: []byte(`{}`), }) diff --git a/internal/testhelpers/e2e_server.go b/internal/testhelpers/e2e_server.go index d3352c111578..7c41f76fceba 100644 --- a/internal/testhelpers/e2e_server.go +++ b/internal/testhelpers/e2e_server.go @@ -85,6 +85,7 @@ func startE2EServerOnly(t *testing.T, configFile string, isTLS bool, configOptio ) //nolint:staticcheck + //lint:ignore SA1029 we really want this ctx = context.WithValue(ctx, "dsn", dsn) ctx, cancel := context.WithCancel(ctx) executor := &cmdx.CommandExecuter{ diff --git a/internal/testhelpers/selfservice_recovery.go b/internal/testhelpers/selfservice_recovery.go index 479a49fe8e90..c1ff66794553 100644 --- a/internal/testhelpers/selfservice_recovery.go +++ b/internal/testhelpers/selfservice_recovery.go @@ -1,7 +1,6 @@ // Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 -// nolint package testhelpers import ( diff --git a/internal/testhelpers/selfservice_settings.go b/internal/testhelpers/selfservice_settings.go index c81834c95751..25e7b7087eb7 100644 --- a/internal/testhelpers/selfservice_settings.go +++ b/internal/testhelpers/selfservice_settings.go @@ -1,7 +1,6 @@ // Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 -// nolint package testhelpers import ( diff --git a/internal/testhelpers/selfservice_verification.go b/internal/testhelpers/selfservice_verification.go index 9273d402901e..c1b84f3d5430 100644 --- a/internal/testhelpers/selfservice_verification.go +++ b/internal/testhelpers/selfservice_verification.go @@ -1,7 +1,6 @@ // Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 -// nolint package testhelpers import ( diff --git a/persistence/sql/persister_test.go b/persistence/sql/persister_test.go index ecad60985c82..db17dac8cb55 100644 --- a/persistence/sql/persister_test.go +++ b/persistence/sql/persister_test.go @@ -57,7 +57,6 @@ func init() { //pop.Debug = true } -// nolint:staticcheck func TestMain(m *testing.M) { atexit := dockertest.NewOnExit() atexit.Add(func() { diff --git a/schema/handler.go b/schema/handler.go index aeceb5bd59ef..d628f3e181e7 100644 --- a/schema/handler.go +++ b/schema/handler.go @@ -67,13 +67,17 @@ func (h *Handler) RegisterAdminRoutes(admin *x.RouterAdmin) { // Raw JSON Schema // // swagger:model identitySchema -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type identitySchema json.RawMessage // Get Identity JSON Schema Response // -// nolint:deadcode,unused // swagger:parameters getIdentitySchema +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getIdentitySchema struct { // ID must be set to the ID of schema you want to get // @@ -150,8 +154,10 @@ type identitySchemaContainer struct { // List Identity JSON Schemas Response // -// nolint:deadcode,unused // swagger:parameters listIdentitySchemas +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listIdentitySchemas struct { migrationpagination.RequestParameters } @@ -159,7 +165,9 @@ type listIdentitySchemas struct { // List Identity JSON Schemas Response // // swagger:response identitySchemas -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type identitySchemasResponse struct { migrationpagination.ResponseHeaderAnnotation diff --git a/selfservice/errorx/handler.go b/selfservice/errorx/handler.go index 1d555926d67b..4e0c7968db6c 100644 --- a/selfservice/errorx/handler.go +++ b/selfservice/errorx/handler.go @@ -55,8 +55,10 @@ func (h *Handler) RegisterAdminRoutes(public *x.RouterAdmin) { public.GET(RouteGet, x.RedirectToPublicRoute(h.r)) } -// nolint:deadcode,unused // swagger:parameters getFlowError +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getFlowError struct { // Error is the error's ID // diff --git a/selfservice/flow/login/handler.go b/selfservice/flow/login/handler.go index 4812b88bbb02..a66f2f420e74 100644 --- a/selfservice/flow/login/handler.go +++ b/selfservice/flow/login/handler.go @@ -214,8 +214,10 @@ func (h *Handler) FromOldFlow(w http.ResponseWriter, r *http.Request, of Flow) ( // Create Native Login Flow Parameters // -// nolint:deadcode,unused // swagger:parameters createNativeLoginFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createNativeLoginFlow struct { // Refresh a login session // @@ -288,8 +290,10 @@ func (h *Handler) createNativeLoginFlow(w http.ResponseWriter, r *http.Request, // Initialize Browser Login Flow Parameters // -// nolint:deadcode,unused // swagger:parameters createBrowserLoginFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createBrowserLoginFlow struct { // Refresh a login session // @@ -441,8 +445,10 @@ func (h *Handler) createBrowserLoginFlow(w http.ResponseWriter, r *http.Request, // Get Login Flow Parameters // -// nolint:deadcode,unused // swagger:parameters getLoginFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getLoginFlow struct { // The Login Flow ID // @@ -549,8 +555,10 @@ func (h *Handler) getLoginFlow(w http.ResponseWriter, r *http.Request, _ httprou // Update Login Flow Parameters // -// nolint:deadcode,unused // swagger:parameters updateLoginFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateLoginFlow struct { // The Login Flow ID // @@ -581,7 +589,9 @@ type updateLoginFlow struct { } // swagger:model updateLoginFlowBody -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateLoginFlowBody struct{} // swagger:route POST /self-service/login frontend updateLoginFlow diff --git a/selfservice/flow/logout/handler.go b/selfservice/flow/logout/handler.go index fb0e17c5b80c..36aec9b2e4bf 100644 --- a/selfservice/flow/logout/handler.go +++ b/selfservice/flow/logout/handler.go @@ -86,7 +86,9 @@ type logoutFlow struct { // Create Browser Logout Flow Parameters // // swagger:parameters createBrowserLogoutFlow -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createBrowserLogoutFlow struct { // HTTP Cookies // @@ -139,7 +141,9 @@ func (h *Handler) createBrowserLogoutFlow(w http.ResponseWriter, r *http.Request // Perform Native Logout Parameters // // swagger:parameters performNativeLogout -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type performNativeLogout struct { // in: body // required: true @@ -148,8 +152,10 @@ type performNativeLogout struct { // Perform Native Logout Request Body // -// nolint:deadcode,unused // swagger:model performNativeLogoutBody +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type performNativeLogoutBody struct { // The Session Token // @@ -208,8 +214,10 @@ func (h *Handler) performNativeLogout(w http.ResponseWriter, r *http.Request, _ // Update Logout Flow Parameters // -// nolint:deadcode,unused // swagger:parameters updateLogoutFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateLogoutFlow struct { // A Valid Logout Token // diff --git a/selfservice/flow/recovery/handler.go b/selfservice/flow/recovery/handler.go index 02b1c875ac74..40d79ffaf182 100644 --- a/selfservice/flow/recovery/handler.go +++ b/selfservice/flow/recovery/handler.go @@ -147,8 +147,10 @@ func (h *Handler) createNativeRecoveryFlow(w http.ResponseWriter, r *http.Reques // Create Browser Recovery Flow Parameters // -// nolint:deadcode,unused // swagger:parameters createBrowserRecoveryFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createBrowserRecoveryFlow struct { // The URL to return the browser to after the flow was completed. // @@ -208,8 +210,10 @@ func (h *Handler) createBrowserRecoveryFlow(w http.ResponseWriter, r *http.Reque // Get Recovery Flow Parameters // -// nolint:deadcode,unused // swagger:parameters getRecoveryFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getRecoveryFlow struct { // The Flow ID // @@ -305,8 +309,10 @@ func (h *Handler) getRecoveryFlow(w http.ResponseWriter, r *http.Request, _ http // Update Recovery Flow Parameters // -// nolint:deadcode,unused // swagger:parameters updateRecoveryFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateRecoveryFlow struct { // The Recovery Flow ID // @@ -344,7 +350,9 @@ type updateRecoveryFlow struct { // Update Recovery Flow Request Body // // swagger:model updateRecoveryFlowBody -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateRecoveryFlowBody struct{} // swagger:route POST /self-service/recovery frontend updateRecoveryFlow diff --git a/selfservice/flow/recovery/handler_test.go b/selfservice/flow/recovery/handler_test.go index f694a8259c6e..9f5a15f26204 100644 --- a/selfservice/flow/recovery/handler_test.go +++ b/selfservice/flow/recovery/handler_test.go @@ -279,6 +279,7 @@ func TestGetFlow(t *testing.T) { // submit the flow but it is expired u := public.URL + recovery.RouteSubmitFlow + "?flow=" + f.ID.String() res, err := client.PostForm(u, url.Values{"email": {"email@ory.sh"}, "csrf_token": {f.CSRFToken}, "method": {"link"}}) + require.NoError(t, err) resBody, err := io.ReadAll(res.Body) require.NoError(t, err) require.NoError(t, res.Body.Close()) diff --git a/selfservice/flow/registration/handler.go b/selfservice/flow/registration/handler.go index 67a011d76e01..9466f8971bd8 100644 --- a/selfservice/flow/registration/handler.go +++ b/selfservice/flow/registration/handler.go @@ -197,8 +197,10 @@ func (h *Handler) createNativeRegistrationFlow(w http.ResponseWriter, r *http.Re // Create Browser Registration Flow Parameters // -// nolint:deadcode,unused // swagger:parameters createBrowserRegistrationFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createBrowserRegistrationFlow struct { // The URL to return the browser to after the flow was completed. // @@ -309,8 +311,10 @@ func (h *Handler) createBrowserRegistrationFlow(w http.ResponseWriter, r *http.R // Get Registration Flow Parameters // -// nolint:deadcode,unused // swagger:parameters getRegistrationFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getRegistrationFlow struct { // The Registration Flow ID // @@ -423,7 +427,9 @@ func (h *Handler) getRegistrationFlow(w http.ResponseWriter, r *http.Request, ps // Update Registration Flow Parameters // // swagger:parameters updateRegistrationFlow -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateRegistrationFlow struct { // The Registration Flow ID // @@ -451,7 +457,9 @@ type updateRegistrationFlow struct { // Update Registration Request Body // // swagger:model updateRegistrationFlowBody -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateRegistrationFlowBody struct{} // swagger:route POST /self-service/registration frontend updateRegistrationFlow diff --git a/selfservice/flow/registration/handler_test.go b/selfservice/flow/registration/handler_test.go index 7ad1830c3a44..4137188b990d 100644 --- a/selfservice/flow/registration/handler_test.go +++ b/selfservice/flow/registration/handler_test.go @@ -342,6 +342,7 @@ func TestGetFlow(t *testing.T) { // submit the flow but it is expired u := public.URL + registration.RouteSubmitFlow + "?flow=" + f.ID.String() res, err := client.PostForm(u, url.Values{"method": {"password"}, "csrf_token": {f.CSRFToken}, "password": {"password"}, "traits.email": {"email@ory.sh"}}) + require.NoError(t, err) resBody, err := io.ReadAll(res.Body) require.NoError(t, err) require.NoError(t, res.Body.Close()) diff --git a/selfservice/flow/settings/handler.go b/selfservice/flow/settings/handler.go index fdf55e9ee530..6e30545c7f39 100644 --- a/selfservice/flow/settings/handler.go +++ b/selfservice/flow/settings/handler.go @@ -165,7 +165,9 @@ func (h *Handler) FromOldFlow(w http.ResponseWriter, r *http.Request, i *identit // Create Native Settings Flow Parameters // // swagger:parameters createNativeSettingsFlow -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createNativeSettingsFlow struct { // The Session Token of the Identity performing the settings flow. // @@ -229,8 +231,10 @@ func (h *Handler) createNativeSettingsFlow(w http.ResponseWriter, r *http.Reques // Create Browser Settings Flow Parameters // -// nolint:deadcode,unused // swagger:parameters createBrowserSettingsFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createBrowserSettingsFlow struct { // The URL to return the browser to after the flow was completed. // @@ -311,8 +315,10 @@ func (h *Handler) createBrowserSettingsFlow(w http.ResponseWriter, r *http.Reque // Get Settings Flow // -// nolint:deadcode,unused // swagger:parameters getSettingsFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getSettingsFlow struct { // ID is the Settings Flow ID // @@ -426,8 +432,10 @@ func (h *Handler) fetchFlow(w http.ResponseWriter, r *http.Request) error { // Update Settings Flow Parameters // -// nolint:deadcode,unused // swagger:parameters updateSettingsFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateSettingsFlow struct { // The Settings Flow ID // @@ -460,7 +468,9 @@ type updateSettingsFlow struct { // Update Settings Flow Request Body // // swagger:model updateSettingsFlowBody -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateSettingsFlowBody struct{} // swagger:route POST /self-service/settings frontend updateSettingsFlow diff --git a/selfservice/flow/settings/handler_test.go b/selfservice/flow/settings/handler_test.go index 0b84bc6f8468..107861b05fc1 100644 --- a/selfservice/flow/settings/handler_test.go +++ b/selfservice/flow/settings/handler_test.go @@ -290,6 +290,7 @@ func TestHandler(t *testing.T) { // submit the flow but it is expired u := publicTS.URL + settings.RouteSubmitFlow + "?flow=" + f.ID.String() res, err := client.PostForm(u, url.Values{"method": {"password"}, "csrf_token": {"csrf"}, "password": {"password"}}) + require.NoError(t, err) resBody, err := io.ReadAll(res.Body) require.NoError(t, err) require.NoError(t, res.Body.Close()) diff --git a/selfservice/flow/verification/handler.go b/selfservice/flow/verification/handler.go index 748394f0c7d7..b6ef8e3597ce 100644 --- a/selfservice/flow/verification/handler.go +++ b/selfservice/flow/verification/handler.go @@ -156,8 +156,10 @@ func (h *Handler) createNativeVerificationFlow(w http.ResponseWriter, r *http.Re // Create Browser Verification Flow Parameters // -// nolint:deadcode,unused // swagger:parameters createBrowserVerificationFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createBrowserVerificationFlow struct { // The URL to return the browser to after the flow was completed. // @@ -203,7 +205,9 @@ func (h *Handler) createBrowserVerificationFlow(w http.ResponseWriter, r *http.R // Get Verification Flow Parameters // // swagger:parameters getVerificationFlow -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getVerificationFlow struct { // The Flow ID // @@ -298,8 +302,10 @@ func (h *Handler) getVerificationFlow(w http.ResponseWriter, r *http.Request, _ // Update Verification Flow Parameters // -// nolint:deadcode,unused // swagger:parameters updateVerificationFlow +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateVerificationFlow struct { // The Verification Flow ID // @@ -336,8 +342,10 @@ type updateVerificationFlow struct { // Update Verification Flow Request Body // -// nolint:deadcode,unused // swagger:model updateVerificationFlowBody +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateVerificationFlowBody struct{} // swagger:route POST /self-service/verification frontend updateVerificationFlow diff --git a/selfservice/flow/verification/handler_test.go b/selfservice/flow/verification/handler_test.go index a3aafc396c1e..944b5eb0cbd9 100644 --- a/selfservice/flow/verification/handler_test.go +++ b/selfservice/flow/verification/handler_test.go @@ -135,6 +135,7 @@ func TestGetFlow(t *testing.T) { // submit the flow but it is expired u := public.URL + verification.RouteSubmitFlow + "?flow=" + f.ID.String() res, err := client.PostForm(u, url.Values{"method": {"link"}, "csrf_token": {f.CSRFToken}, "email": {"email@ory.sh"}}) + require.NoError(t, err) resBody, err := io.ReadAll(res.Body) require.NoError(t, err) require.NoError(t, res.Body.Close()) diff --git a/selfservice/hook/verification_test.go b/selfservice/hook/verification_test.go index 67c444620d31..db1f7c536ffa 100644 --- a/selfservice/hook/verification_test.go +++ b/selfservice/hook/verification_test.go @@ -121,6 +121,7 @@ func TestVerifier(t *testing.T) { require.NoError(t, hf(h, i, originalFlow)) expectedVerificationFlow, err = verification.NewPostHookFlow(conf, conf.SelfServiceFlowVerificationRequestLifespan(ctx), "", u, s, originalFlow) + require.NoError(t, err) var verificationFlow2 verification.Flow require.NoError(t, reg.Persister().GetConnection(context.Background()).First(&verificationFlow2)) assert.Equal(t, expectedVerificationFlow.RequestURL, verificationFlow2.RequestURL) diff --git a/selfservice/strategy/code/strategy_recovery.go b/selfservice/strategy/code/strategy_recovery.go index b7ffc85320ba..b104c7df12fc 100644 --- a/selfservice/strategy/code/strategy_recovery.go +++ b/selfservice/strategy/code/strategy_recovery.go @@ -67,7 +67,8 @@ func (s *Strategy) PopulateRecoveryMethod(r *http.Request, f *recovery.Flow) err // // swagger:parameters createRecoveryCodeForIdentity // -// nolint +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createRecoveryCodeForIdentity struct { // in: body Body createRecoveryCodeForIdentityBody @@ -103,7 +104,9 @@ type createRecoveryCodeForIdentityBody struct { // Used when an administrator creates a recovery code for an identity. // // swagger:model recoveryCodeForIdentity -// nolint +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type recoveryCodeForIdentity struct { // RecoveryLink with flow // @@ -239,7 +242,9 @@ func (s *Strategy) createRecoveryCodeForIdentity(w http.ResponseWriter, r *http. // Update Recovery Flow with Code Method // // swagger:model updateRecoveryFlowWithCodeMethod -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateRecoveryFlowWithCodeMethod struct { // Email to Recover // diff --git a/selfservice/strategy/code/strategy_recovery_test.go b/selfservice/strategy/code/strategy_recovery_test.go index c5f405796c14..1cc37d8df4bf 100644 --- a/selfservice/strategy/code/strategy_recovery_test.go +++ b/selfservice/strategy/code/strategy_recovery_test.go @@ -127,6 +127,7 @@ func TestAdminStrategy(t *testing.T) { res, err = publicTS.Client().PostForm(action, url.Values{ "code": {code}, }) + require.NoError(t, err) assert.Equal(t, http.StatusOK, res.StatusCode) return ioutilx.MustReadAll(res.Body) @@ -764,6 +765,7 @@ func TestRecovery(t *testing.T) { Id(flowId). Execute() + require.NoError(t, err) body := ioutilx.MustReadAll(res.Body) require.NotEmpty(t, body) diff --git a/selfservice/strategy/code/strategy_verification_test.go b/selfservice/strategy/code/strategy_verification_test.go index f6387c331c52..ce59c7593598 100644 --- a/selfservice/strategy/code/strategy_verification_test.go +++ b/selfservice/strategy/code/strategy_verification_test.go @@ -364,8 +364,7 @@ func TestVerification(t *testing.T) { require.Len(t, cl.Jar.Cookies(urlx.ParseOrPanic(public.URL)), 1) assert.Contains(t, cl.Jar.Cookies(urlx.ParseOrPanic(public.URL))[0].Name, x.CSRFTokenName) - actualBody, res := submitVerificationCode(t, body, cl, code) - + actualBody, _ := submitVerificationCode(t, body, cl, code) assert.EqualValues(t, "passed_challenge", gjson.Get(actualBody, "state").String()) }) @@ -435,6 +434,7 @@ func TestVerification(t *testing.T) { c := testhelpers.NewDebugClient(t) res, err = c.Post(action, "application/json", strings.NewReader(fmt.Sprintf(`{"code": "%v"}`, code))) + require.NoError(t, err) assert.Equal(t, http.StatusOK, res.StatusCode) f1 := ioutilx.MustReadAll(res.Body) @@ -442,6 +442,7 @@ func TestVerification(t *testing.T) { assert.EqualValues(t, "passed_challenge", gjson.GetBytes(f1, "state").String()) res, err = c.Post(action, "application/json", strings.NewReader(fmt.Sprintf(`{"code": "%v"}`, code))) + require.NoError(t, err) assert.Equal(t, http.StatusGone, res.StatusCode) f2 := ioutilx.MustReadAll(res.Body) diff --git a/selfservice/strategy/link/strategy_recovery.go b/selfservice/strategy/link/strategy_recovery.go index 62267147ec4c..cefd870d08ec 100644 --- a/selfservice/strategy/link/strategy_recovery.go +++ b/selfservice/strategy/link/strategy_recovery.go @@ -63,7 +63,8 @@ func (s *Strategy) PopulateRecoveryMethod(r *http.Request, f *recovery.Flow) err // // swagger:parameters createRecoveryLinkForIdentity // -// nolint +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type createRecoveryLinkForIdentity struct { // in: body Body createRecoveryLinkForIdentityBody @@ -99,7 +100,6 @@ type createRecoveryLinkForIdentityBody struct { // Used when an administrator creates a recovery link for an identity. // // swagger:model recoveryLinkForIdentity -// nolint type recoveryLinkForIdentity struct { // Recovery Link // @@ -205,7 +205,9 @@ func (s *Strategy) createRecoveryLinkForIdentity(w http.ResponseWriter, r *http. // Update Recovery Flow with Link Method // // swagger:model updateRecoveryFlowWithLinkMethod -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateRecoveryFlowWithLinkMethod struct { // Email to Recover // diff --git a/selfservice/strategy/link/strategy_verification.go b/selfservice/strategy/link/strategy_verification.go index 8b11c4213cb5..4488c18a4227 100644 --- a/selfservice/strategy/link/strategy_verification.go +++ b/selfservice/strategy/link/strategy_verification.go @@ -89,7 +89,9 @@ func (s *Strategy) handleVerificationError(w http.ResponseWriter, r *http.Reques // Update Verification Flow with Link Method // // swagger:model updateVerificationFlowWithLinkMethod -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateVerificationFlowWithLinkMethod struct { // Email to Verify // diff --git a/selfservice/strategy/oidc/strategy_settings.go b/selfservice/strategy/oidc/strategy_settings.go index 785126bff69c..db3bce6f0c0b 100644 --- a/selfservice/strategy/oidc/strategy_settings.go +++ b/selfservice/strategy/oidc/strategy_settings.go @@ -180,8 +180,10 @@ func (s *Strategy) PopulateSettingsMethod(r *http.Request, id *identity.Identity // Update Settings Flow with OpenID Connect Method // -// nolint:deadcode,unused // swagger:model updateSettingsFlowWithOidcMethod +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateSettingsFlowWithOidcMethod struct { // Method // diff --git a/selfservice/strategy/password/strategy_disabled_test.go b/selfservice/strategy/password/strategy_disabled_test.go index b1f23789d4b7..6cf92147c3a4 100644 --- a/selfservice/strategy/password/strategy_disabled_test.go +++ b/selfservice/strategy/password/strategy_disabled_test.go @@ -35,6 +35,7 @@ func TestDisabledEndpoint(t *testing.T) { assert.Equal(t, http.StatusNotFound, res.StatusCode) b, err := io.ReadAll(res.Body) + require.NoError(t, err) assert.Contains(t, string(b), "This endpoint was disabled by system administrator", "%s", b) }) @@ -47,6 +48,7 @@ func TestDisabledEndpoint(t *testing.T) { assert.Equal(t, http.StatusNotFound, res.StatusCode) b, err := io.ReadAll(res.Body) + require.NoError(t, err) assert.Contains(t, string(b), "This endpoint was disabled by system administrator", "%s", b) }) @@ -69,6 +71,7 @@ func TestDisabledEndpoint(t *testing.T) { assert.Equal(t, http.StatusNotFound, res.StatusCode) b, err := io.ReadAll(res.Body) + require.NoError(t, err) assert.Contains(t, string(b), "This endpoint was disabled by system administrator", "%s", b) }) }) diff --git a/selfservice/strategy/profile/strategy.go b/selfservice/strategy/profile/strategy.go index da9d8190bc53..5c4a68be9a78 100644 --- a/selfservice/strategy/profile/strategy.go +++ b/selfservice/strategy/profile/strategy.go @@ -180,8 +180,10 @@ func (s *Strategy) continueFlow(w http.ResponseWriter, r *http.Request, ctxUpdat // Update Settings Flow with Profile Method // -// nolint:deadcode,unused // swagger:model updateSettingsFlowWithProfileMethod +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type updateSettingsFlowWithProfileMethod struct { // Traits // diff --git a/selfservice/strategy/profile/strategy_test.go b/selfservice/strategy/profile/strategy_test.go index 8602957bfcba..bb09a2b925a0 100644 --- a/selfservice/strategy/profile/strategy_test.go +++ b/selfservice/strategy/profile/strategy_test.go @@ -223,7 +223,7 @@ func TestStrategyTraits(t *testing.T) { rid := res.Request.URL.Query().Get("flow") require.NotEmpty(t, rid) - pr, res, err := testhelpers.NewSDKCustomClient(publicTS, browserUser1).FrontendApi.GetSettingsFlow(context.Background()).Id(res.Request.URL.Query().Get("flow")).Execute() + pr, _, err := testhelpers.NewSDKCustomClient(publicTS, browserUser1).FrontendApi.GetSettingsFlow(context.Background()).Id(res.Request.URL.Query().Get("flow")).Execute() require.NoError(t, err, "%s", rid) run(t, browserIdentity1, pr, settings.RouteInitBrowserFlow) diff --git a/selfservice/strategy/webauthn/settings_test.go b/selfservice/strategy/webauthn/settings_test.go index 2db72dea4f81..04f571e7ab5e 100644 --- a/selfservice/strategy/webauthn/settings_test.go +++ b/selfservice/strategy/webauthn/settings_test.go @@ -376,7 +376,7 @@ func TestCompleteSettings(t *testing.T) { // The remove key should be empty snapshotx.SnapshotTExcept(t, v, []string{"csrf_token"}) - v.Set(node.WebAuthnRemove, fmt.Sprintf("666f6f666f6f")) + v.Set(node.WebAuthnRemove, "666f6f666f6f") }, id) if spa { @@ -416,7 +416,7 @@ func TestCompleteSettings(t *testing.T) { body, res := doBrowserFlow(t, spa, func(v url.Values) { // The remove key should be set snapshotx.SnapshotTExcept(t, v, []string{"csrf_token"}) - v.Set(node.WebAuthnRemove, fmt.Sprintf("666f6f666f6f")) + v.Set(node.WebAuthnRemove, "666f6f666f6f") }, id) if spa { diff --git a/session/handler.go b/session/handler.go index d43dc85d6710..c1de13e54f0c 100644 --- a/session/handler.go +++ b/session/handler.go @@ -101,8 +101,10 @@ func (h *Handler) RegisterPublicRoutes(public *x.RouterPublic) { // Check Session Request Parameters // -// nolint:deadcode,unused // swagger:parameters toSession +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type toSession struct { // Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. // @@ -231,7 +233,9 @@ func (h *Handler) whoami(w http.ResponseWriter, r *http.Request, ps httprouter.P // Delete Identity Session Parameters // // swagger:parameters deleteIdentitySessions -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type deleteIdentitySessions struct { // ID is the identity's ID. // @@ -276,7 +280,9 @@ func (h *Handler) deleteIdentitySessions(w http.ResponseWriter, r *http.Request, // The request object for listing sessions in an administrative context. // // swagger:parameters listSessions -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listSessionsRequest struct { keysetpagination.RequestParameters @@ -300,7 +306,9 @@ type listSessionsRequest struct { // The response given when listing sessions in an administrative context. // // swagger:response listSessions -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listSessionsResponse struct { keysetpagination.ResponseHeaders @@ -372,7 +380,9 @@ func (h *Handler) adminListSessions(w http.ResponseWriter, r *http.Request, ps h // The request object for getting a session in an administrative context. // // swagger:parameters getSession -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type getSession struct { // ExpandOptions is a query parameter encoded list of all properties that must be expanded in the Session. // Example - ?expand=Identity&expand=Devices @@ -449,7 +459,9 @@ func (h *Handler) getSession(w http.ResponseWriter, r *http.Request, ps httprout // Deactivate Session Parameters // // swagger:parameters disableSession -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type disableSession struct { // ID is the session's ID. // @@ -492,7 +504,9 @@ func (h *Handler) disableSession(w http.ResponseWriter, r *http.Request, ps http // List Identity Sessions Parameters // // swagger:parameters listIdentitySessions -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listIdentitySessionsRequest struct { migrationpagination.RequestParameters @@ -512,7 +526,9 @@ type listIdentitySessionsRequest struct { // List Identity Sessions Response // // swagger:response listIdentitySessions -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listIdentitySessionsResponse struct { migrationpagination.ResponseHeaderAnnotation @@ -576,8 +592,10 @@ type deleteMySessionsCount struct { // Disable My Other Session Parameters // -// nolint:deadcode,unused // swagger:parameters disableMyOtherSessions +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type disableMyOtherSessions struct { // Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. // @@ -628,7 +646,9 @@ func (h *Handler) deleteMySessions(w http.ResponseWriter, r *http.Request, _ htt // Disable My Session Parameters // // swagger:parameters disableMySession -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type disableMySession struct { // ID is the session's ID. // @@ -668,7 +688,7 @@ type disableMySession struct { func (h *Handler) deleteMySession(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { sid := ps.ByName("id") if sid == "whoami" { - // Special case where we actually want to handle the whomai endpoint. + // Special case where we actually want to handle the whoami endpoint. h.whoami(w, r, ps) return } @@ -701,7 +721,9 @@ func (h *Handler) deleteMySession(w http.ResponseWriter, r *http.Request, ps htt // List My Session Parameters // // swagger:parameters listMySessions -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listMySessionsParameters struct { x.PaginationParams @@ -723,7 +745,9 @@ type listMySessionsParameters struct { // List My Session Response // // swagger:response listMySessions -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type listMySessionsResponse struct { migrationpagination.ResponseHeaderAnnotation @@ -781,7 +805,9 @@ func (h *Handler) IsAuthenticated(wrap httprouter.Handle, onUnauthenticated http } // swagger:parameters extendSession -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type extendSession struct { // ID is the session's ID. // diff --git a/session/handler_test.go b/session/handler_test.go index 4052acbe56ca..1b0b7c618bad 100644 --- a/session/handler_test.go +++ b/session/handler_test.go @@ -50,19 +50,6 @@ func send(code int) httprouter.Handle { } } -func getSessionCookie(t *testing.T, r *http.Response) *http.Cookie { - var sessionCookie *http.Cookie - var found bool - for _, c := range r.Cookies() { - if c.Name == config.DefaultSessionCookieName { - found = true - sessionCookie = c - } - } - require.True(t, found) - return sessionCookie -} - func assertNoCSRFCookieInResponse(t *testing.T, _ *httptest.Server, _ *http.Client, r *http.Response) { found := false for _, c := range r.Cookies() { diff --git a/swagger_types_global.go b/swagger_types_global.go index ce363f9a34fe..05911913684f 100644 --- a/swagger_types_global.go +++ b/swagger_types_global.go @@ -1,7 +1,6 @@ // Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 -// nolint:deadcode,unused package main import "github.com/ory/herodot" @@ -11,6 +10,9 @@ import "github.com/ory/herodot" // The standard Ory JSON API error format. // // swagger:model errorGeneric +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type errorGeneric struct { // Contains error details // @@ -21,4 +23,7 @@ type errorGeneric struct { // Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. // // swagger:response emptyResponse +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type emptyResponse struct{} diff --git a/swagger_types_overrides.go b/swagger_types_overrides.go index dee41679ad00..e5026cc94173 100644 --- a/swagger_types_overrides.go +++ b/swagger_types_overrides.go @@ -6,5 +6,7 @@ package main import "github.com/go-openapi/strfmt" // swagger:model UUID -// nolint:deadcode,unused +// +//nolint:deadcode,unused +//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions type uuid strfmt.UUID4