From b507c21df92a863b84e67f2282f79f73f1b9979c Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 13 Mar 2023 14:37:21 +0100 Subject: [PATCH 1/5] update nix Signed-off-by: Mark Sagi-Kazar --- flake.lock | 12 ++++++------ flake.nix | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/flake.lock b/flake.lock index b67b61d9..ca6b45e5 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1662019588, - "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=", + "lastModified": 1678654296, + "narHash": "sha256-aVfw3ThpY7vkUeF1rFy10NAkpKDS2imj3IakrzT0Occ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2da64a81275b68fdad38af669afeda43d401e94b", + "rev": "5a1dc8acd977ff3dccd1328b7c4a6995429a656b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 155ebf99..878dd4c4 100644 --- a/flake.nix +++ b/flake.nix @@ -9,19 +9,19 @@ outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem ( system: - let - pkgs = nixpkgs.legacyPackages.${system}; - buildDeps = with pkgs; [ git go_1_19 gnumake ]; - devDeps = with pkgs; - buildDeps ++ [ - golangci-lint - gotestsum - protobuf - protoc-gen-go - protoc-gen-go-grpc - kind - ]; - in - { devShell = pkgs.mkShell { buildInputs = devDeps; }; } + let + pkgs = nixpkgs.legacyPackages.${system}; + buildDeps = with pkgs; [ git go_1_20 gnumake ]; + devDeps = with pkgs; + buildDeps ++ [ + golangci-lint + gotestsum + protobuf + protoc-gen-go + protoc-gen-go-grpc + kind + ]; + in + { devShell = pkgs.mkShell { buildInputs = devDeps; }; } ); } From d12a1fc6875247900da33f598557d671fc4808eb Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sat, 18 Mar 2023 13:31:11 +0100 Subject: [PATCH 2/5] update linter Signed-off-by: Mark Sagi-Kazar --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c1aea638..db373729 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ export GOBIN=$(PWD)/bin LD_FLAGS="-w -X main.version=$(VERSION)" # Dependency versions -GOLANGCI_VERSION = 1.51.2 -GOTESTSUM_VERSION ?= 1.7.0 +GOLANGCI_VERSION = 1.52.0 +GOTESTSUM_VERSION ?= 1.9.0 PROTOC_VERSION = 3.15.6 PROTOC_GEN_GO_VERSION = 1.26.0 From bf410dfd16828fdb92b22d959f6be52aaee3756e Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sat, 18 Mar 2023 14:14:21 +0100 Subject: [PATCH 3/5] chore(deps): update ent Signed-off-by: Mark Sagi-Kazar --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 536db3ab..9cb7c25c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/dexidp/dex go 1.20 require ( - entgo.io/ent v0.11.9 + entgo.io/ent v0.11.10 github.com/AppsFlyer/go-sundheit v0.5.0 github.com/Masterminds/semver v1.5.0 github.com/Masterminds/sprig/v3 v3.2.3 @@ -41,7 +41,7 @@ require ( ) require ( - ariga.io/atlas v0.9.1 // indirect + ariga.io/atlas v0.9.2-0.20230303073438-03a4779a6338 // indirect cloud.google.com/go/compute v1.18.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect github.com/Azure/go-ntlmssp v0.0.0-20220621081337-cb9428e4ac1e // indirect diff --git a/go.sum b/go.sum index b8278475..f00a89f3 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -ariga.io/atlas v0.9.1 h1:EpoPMnwsQG0vn9c0sYExpwSYtr7bvuSUXzQclU2pMjc= -ariga.io/atlas v0.9.1/go.mod h1:T230JFcENj4ZZzMkZrXFDSkv+2kXkUgpJ5FQQ5hMcKU= +ariga.io/atlas v0.9.2-0.20230303073438-03a4779a6338 h1:8kmSV3mbQKn0niZ/EdE11uhFvFKiW1VlaqVBIYOyahM= +ariga.io/atlas v0.9.2-0.20230303073438-03a4779a6338/go.mod h1:T230JFcENj4ZZzMkZrXFDSkv+2kXkUgpJ5FQQ5hMcKU= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -40,8 +40,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -entgo.io/ent v0.11.9 h1:dbbCkAiPVTRBIJwoZctiSYjB7zxQIBOzVSU5H9VYIQI= -entgo.io/ent v0.11.9/go.mod h1:KWHOcDZn1xk3mz3ipWdKrQpMvwqa/9B69TUuAPP9W6g= +entgo.io/ent v0.11.10 h1:iqn32ybY5HRW3xSAyMNdNKpZhKgMf1Zunsej9yPKUI8= +entgo.io/ent v0.11.10/go.mod h1:mzTZ0trE+jCQw/fnzijbm5Mck/l8Gbg7gC/+L1COyzM= github.com/AppsFlyer/go-sundheit v0.5.0 h1:/VxpyigCfJrq1r97mn9HPiAB2qrhcTFHwNIIDr15CZM= github.com/AppsFlyer/go-sundheit v0.5.0/go.mod h1:2ZM0BnfqT/mljBQO224VbL5XH06TgWuQ6Cn+cTtCpTY= github.com/Azure/go-ntlmssp v0.0.0-20220621081337-cb9428e4ac1e h1:NeAW1fUYUEWhft7pkxDf6WoUvEZJ/uOKsvtpjLnn8MU= From bbed8a056aa4f20564f604fa2a6e9da74b81a282 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sat, 18 Mar 2023 14:14:30 +0100 Subject: [PATCH 4/5] chore: regenerate ent Signed-off-by: Mark Sagi-Kazar --- storage/ent/db/authcode/where.go | 10 ++++++++++ storage/ent/db/authrequest/where.go | 10 ++++++++++ storage/ent/db/connector/where.go | 10 ++++++++++ storage/ent/db/ent.go | 2 +- storage/ent/db/keys/where.go | 10 ++++++++++ storage/ent/db/oauth2client/where.go | 10 ++++++++++ storage/ent/db/offlinesession/where.go | 10 ++++++++++ storage/ent/db/refreshtoken/where.go | 10 ++++++++++ storage/ent/db/runtime/runtime.go | 4 ++-- 9 files changed, 73 insertions(+), 3 deletions(-) diff --git a/storage/ent/db/authcode/where.go b/storage/ent/db/authcode/where.go index b1708d02..87f1f6e6 100644 --- a/storage/ent/db/authcode/where.go +++ b/storage/ent/db/authcode/where.go @@ -54,6 +54,16 @@ func IDLTE(id string) predicate.AuthCode { return predicate.AuthCode(sql.FieldLTE(FieldID, id)) } +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.AuthCode { + return predicate.AuthCode(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.AuthCode { + return predicate.AuthCode(sql.FieldContainsFold(FieldID, id)) +} + // ClientID applies equality check predicate on the "client_id" field. It's identical to ClientIDEQ. func ClientID(v string) predicate.AuthCode { return predicate.AuthCode(sql.FieldEQ(FieldClientID, v)) diff --git a/storage/ent/db/authrequest/where.go b/storage/ent/db/authrequest/where.go index daa6b891..10bd7447 100644 --- a/storage/ent/db/authrequest/where.go +++ b/storage/ent/db/authrequest/where.go @@ -54,6 +54,16 @@ func IDLTE(id string) predicate.AuthRequest { return predicate.AuthRequest(sql.FieldLTE(FieldID, id)) } +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.AuthRequest { + return predicate.AuthRequest(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.AuthRequest { + return predicate.AuthRequest(sql.FieldContainsFold(FieldID, id)) +} + // ClientID applies equality check predicate on the "client_id" field. It's identical to ClientIDEQ. func ClientID(v string) predicate.AuthRequest { return predicate.AuthRequest(sql.FieldEQ(FieldClientID, v)) diff --git a/storage/ent/db/connector/where.go b/storage/ent/db/connector/where.go index 5e02bc85..f2efee7a 100644 --- a/storage/ent/db/connector/where.go +++ b/storage/ent/db/connector/where.go @@ -52,6 +52,16 @@ func IDLTE(id string) predicate.Connector { return predicate.Connector(sql.FieldLTE(FieldID, id)) } +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.Connector { + return predicate.Connector(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.Connector { + return predicate.Connector(sql.FieldContainsFold(FieldID, id)) +} + // Type applies equality check predicate on the "type" field. It's identical to TypeEQ. func Type(v string) predicate.Connector { return predicate.Connector(sql.FieldEQ(FieldType, v)) diff --git a/storage/ent/db/ent.go b/storage/ent/db/ent.go index 11f23341..292524ef 100644 --- a/storage/ent/db/ent.go +++ b/storage/ent/db/ent.go @@ -523,7 +523,7 @@ func withHooks[V Value, M any, PM interface { return exec(ctx) } var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutationT, ok := m.(PM) + mutationT, ok := any(m).(PM) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } diff --git a/storage/ent/db/keys/where.go b/storage/ent/db/keys/where.go index b10a431b..9b31c744 100644 --- a/storage/ent/db/keys/where.go +++ b/storage/ent/db/keys/where.go @@ -54,6 +54,16 @@ func IDLTE(id string) predicate.Keys { return predicate.Keys(sql.FieldLTE(FieldID, id)) } +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.Keys { + return predicate.Keys(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.Keys { + return predicate.Keys(sql.FieldContainsFold(FieldID, id)) +} + // NextRotation applies equality check predicate on the "next_rotation" field. It's identical to NextRotationEQ. func NextRotation(v time.Time) predicate.Keys { return predicate.Keys(sql.FieldEQ(FieldNextRotation, v)) diff --git a/storage/ent/db/oauth2client/where.go b/storage/ent/db/oauth2client/where.go index df9114ad..7cde46b5 100644 --- a/storage/ent/db/oauth2client/where.go +++ b/storage/ent/db/oauth2client/where.go @@ -52,6 +52,16 @@ func IDLTE(id string) predicate.OAuth2Client { return predicate.OAuth2Client(sql.FieldLTE(FieldID, id)) } +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.OAuth2Client { + return predicate.OAuth2Client(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.OAuth2Client { + return predicate.OAuth2Client(sql.FieldContainsFold(FieldID, id)) +} + // Secret applies equality check predicate on the "secret" field. It's identical to SecretEQ. func Secret(v string) predicate.OAuth2Client { return predicate.OAuth2Client(sql.FieldEQ(FieldSecret, v)) diff --git a/storage/ent/db/offlinesession/where.go b/storage/ent/db/offlinesession/where.go index 5b7266ea..09ba0140 100644 --- a/storage/ent/db/offlinesession/where.go +++ b/storage/ent/db/offlinesession/where.go @@ -52,6 +52,16 @@ func IDLTE(id string) predicate.OfflineSession { return predicate.OfflineSession(sql.FieldLTE(FieldID, id)) } +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.OfflineSession { + return predicate.OfflineSession(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.OfflineSession { + return predicate.OfflineSession(sql.FieldContainsFold(FieldID, id)) +} + // UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ. func UserID(v string) predicate.OfflineSession { return predicate.OfflineSession(sql.FieldEQ(FieldUserID, v)) diff --git a/storage/ent/db/refreshtoken/where.go b/storage/ent/db/refreshtoken/where.go index ce3a10de..8c50a71a 100644 --- a/storage/ent/db/refreshtoken/where.go +++ b/storage/ent/db/refreshtoken/where.go @@ -54,6 +54,16 @@ func IDLTE(id string) predicate.RefreshToken { return predicate.RefreshToken(sql.FieldLTE(FieldID, id)) } +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.RefreshToken { + return predicate.RefreshToken(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.RefreshToken { + return predicate.RefreshToken(sql.FieldContainsFold(FieldID, id)) +} + // ClientID applies equality check predicate on the "client_id" field. It's identical to ClientIDEQ. func ClientID(v string) predicate.RefreshToken { return predicate.RefreshToken(sql.FieldEQ(FieldClientID, v)) diff --git a/storage/ent/db/runtime/runtime.go b/storage/ent/db/runtime/runtime.go index 56b7cf08..4ebdb5ea 100644 --- a/storage/ent/db/runtime/runtime.go +++ b/storage/ent/db/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/dexidp/dex/storage/ent/db/runtime.go const ( - Version = "v0.11.9" // Version of ent codegen. - Sum = "h1:dbbCkAiPVTRBIJwoZctiSYjB7zxQIBOzVSU5H9VYIQI=" // Sum of ent codegen. + Version = "v0.11.10" // Version of ent codegen. + Sum = "h1:iqn32ybY5HRW3xSAyMNdNKpZhKgMf1Zunsej9yPKUI8=" // Sum of ent codegen. ) From 15c71806128a5d3cace2eb5c3109236da0ddc8a2 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sun, 19 Mar 2023 17:32:20 +0100 Subject: [PATCH 5/5] chore: fix linter by temporarily disabling failing ones Signed-off-by: Mark Sagi-Kazar --- .golangci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 4ed48c7c..1bf6bcff 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -38,8 +38,8 @@ linters: - nakedret - nolintlint - prealloc - - revive - - sqlclosecheck + # - revive + # - sqlclosecheck - staticcheck - stylecheck - unconvert @@ -55,6 +55,9 @@ linters: # Disable temporarily until everything works with Go 1.18 - typecheck + # Disable temporarily until the following issue is resolved: https://github.com/golangci/golangci-lint/issues/3086 + # - sqlclosecheck + # TODO: fix linter errors before enabling # - exhaustivestruct # - gochecknoglobals @@ -63,6 +66,7 @@ linters: # - godot # - nlreturn # - noctx + # - revive # - wrapcheck # TODO: fix linter errors before enabling (from original config)