From 121701b62358a454bbfdccfadfcce9bb843602d6 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Wed, 5 Jun 2024 15:37:44 +0200 Subject: Revert "mod: bump github.com/vektra/mockery/v2 from 2.40.3 to 2.43.2" This reverts commit 568d10fd6d0d9b79cb09fe344bf77bde20ed665f. --- vendor/github.com/vektra/mockery/v2/.mockery.yaml | 11 --- vendor/github.com/vektra/mockery/v2/Taskfile.yml | 2 +- vendor/github.com/vektra/mockery/v2/cmd/mockery.go | 2 +- vendor/github.com/vektra/mockery/v2/codecov.yml | 6 +- vendor/github.com/vektra/mockery/v2/go.work | 4 +- vendor/github.com/vektra/mockery/v2/go.work.sum | 15 +++- vendor/github.com/vektra/mockery/v2/mkdocs.yml | 8 +-- .../vektra/mockery/v2/pkg/config/config.go | 54 +++------------ .../github.com/vektra/mockery/v2/pkg/generator.go | 81 +++------------------- .../github.com/vektra/mockery/v2/pkg/outputter.go | 2 - 10 files changed, 42 insertions(+), 143 deletions(-) (limited to 'vendor/github.com/vektra') diff --git a/vendor/github.com/vektra/mockery/v2/.mockery.yaml b/vendor/github.com/vektra/mockery/v2/.mockery.yaml index ffeed52b2..2559bb86d 100644 --- a/vendor/github.com/vektra/mockery/v2/.mockery.yaml +++ b/vendor/github.com/vektra/mockery/v2/.mockery.yaml @@ -41,17 +41,6 @@ packages: config: with-expecter: True unroll-variadic: False - # Replace generic params with a new constraint and a new fixed value - ReplaceGeneric: - config: - replace-type: - - github.com/vektra/mockery/v2/pkg/fixtures.ReplaceGeneric[-TImport]=github.com/vektra/mockery/v2/pkg/fixtures/redefined_type_b.B - - github.com/vektra/mockery/v2/pkg/fixtures.ReplaceGeneric[TConstraint]=github.com/vektra/mockery/v2/pkg/fixtures/constraints.String - # Replace a generic param with the parent type - ReplaceGenericSelf: - config: - replace-type: - - github.com/vektra/mockery/v2/pkg/fixtures.ReplaceGenericSelf[-T]=github.com/vektra/mockery/v2/pkg/fixtures.*ReplaceGenericSelf github.com/vektra/mockery/v2/pkg/fixtures/recursive_generation: config: recursive: True diff --git a/vendor/github.com/vektra/mockery/v2/Taskfile.yml b/vendor/github.com/vektra/mockery/v2/Taskfile.yml index 4823817c9..5e11bb39a 100644 --- a/vendor/github.com/vektra/mockery/v2/Taskfile.yml +++ b/vendor/github.com/vektra/mockery/v2/Taskfile.yml @@ -13,7 +13,7 @@ tasks: - "**/*.go" cmds: - go fmt ./... - + mocks: desc: generate new mocks from scratch deps: [mocks.remove, mocks.generate] diff --git a/vendor/github.com/vektra/mockery/v2/cmd/mockery.go b/vendor/github.com/vektra/mockery/v2/cmd/mockery.go index 684ffb7b8..da748314d 100644 --- a/vendor/github.com/vektra/mockery/v2/cmd/mockery.go +++ b/vendor/github.com/vektra/mockery/v2/cmd/mockery.go @@ -316,7 +316,7 @@ func (r *RootApp) Run() error { if err != nil { return stackerr.NewStackErrf(err, "Failed to create profile file") } - defer f.Close() + if err := pprof.StartCPUProfile(f); err != nil { return fmt.Errorf("failed to start CPU profile: %w", err) } diff --git a/vendor/github.com/vektra/mockery/v2/codecov.yml b/vendor/github.com/vektra/mockery/v2/codecov.yml index 77f5dee69..465cfd701 100644 --- a/vendor/github.com/vektra/mockery/v2/codecov.yml +++ b/vendor/github.com/vektra/mockery/v2/codecov.yml @@ -1,11 +1,11 @@ coverage: precision: 5 round: down - range: "00...100" + range: "65...100" status: patch: default: - target: 40% - threshold: 35% + target: 65% + threshold: 5% base: auto diff --git a/vendor/github.com/vektra/mockery/v2/go.work b/vendor/github.com/vektra/mockery/v2/go.work index baf732d14..59b494ce2 100644 --- a/vendor/github.com/vektra/mockery/v2/go.work +++ b/vendor/github.com/vektra/mockery/v2/go.work @@ -1,6 +1,6 @@ -go 1.22 +go 1.21 -toolchain go1.22.0 +toolchain go1.21.0 use ( . diff --git a/vendor/github.com/vektra/mockery/v2/go.work.sum b/vendor/github.com/vektra/mockery/v2/go.work.sum index 858e33015..fac3c7ce3 100644 --- a/vendor/github.com/vektra/mockery/v2/go.work.sum +++ b/vendor/github.com/vektra/mockery/v2/go.work.sum @@ -290,6 +290,7 @@ github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/census-instrumentation/opencensus-proto v0.3.0 h1:t/LhUZLVitR1Ow2YOnduCsavhwFUklBMoGVYUCqmCqk= @@ -319,6 +320,7 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534 h1:rtAn27wIbmOGUs7RIbVgPEjb31ehTVniDwPGXyMxm5U= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/cristalhq/acmd v0.11.1 h1:DJ4fh2Pv0nPKmqT646IU/0Vh5FNdGblxvF+3/W3NAUI= github.com/cristalhq/acmd v0.11.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= @@ -339,11 +341,13 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= github.com/go-kit/log v0.1.0 h1:DGJh0Sm43HbOeYDNnVZFl8BvcYVvjD5bqYJvp0REbwQ= github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-toolsmith/pkgload v1.2.2/go.mod h1:R2hxLNRKuAsiXCo2i5J6ZQPhnPMOVtU+f0arbFPWCus= github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= @@ -393,6 +397,7 @@ github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 h1:tlyzajkF3030q6M8SvmJSemC9DTHL/xaMa18b65+JM4= github.com/gookit/color v1.5.2 h1:uLnfXcaFjlrDnQDT+NCBcfhrXqYTx/rcCa6xn01Y8yI= github.com/gookit/color v1.5.2/go.mod h1:w8h4bGiHeeBpvQVePTutdbERIUf3oJE5lZ8HM0UgXyg= +github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= @@ -487,6 +492,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5 h1:0KqC6/sLy7fDpBdybhVkkv4Yz+PmB7c9Dz9z3dLW804= github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= +github.com/onsi/ginkgo/v2 v2.8.0/go.mod h1:6JsQiECmxCa3V5st74AL/AmsV482EDdVrGaVW6z3oYU= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= @@ -564,6 +571,7 @@ go.opentelemetry.io/proto/otlp v0.7.0 h1:rwOQPCuKAKmwGKq2aVNnYIibI6wnV7EvzgfTCzc go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= @@ -579,6 +587,8 @@ golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDA golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -614,6 +624,8 @@ golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -664,6 +676,8 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= @@ -772,7 +786,6 @@ google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5v google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= diff --git a/vendor/github.com/vektra/mockery/v2/mkdocs.yml b/vendor/github.com/vektra/mockery/v2/mkdocs.yml index 4959ac1de..2c59e5767 100644 --- a/vendor/github.com/vektra/mockery/v2/mkdocs.yml +++ b/vendor/github.com/vektra/mockery/v2/mkdocs.yml @@ -83,12 +83,10 @@ extra: property: G-0ZGMQGZGRN plugins: -- glightbox - mike: alias_type: symlink canonical_version: latest -- open-in-new-tab -- search +- glightbox - social -- typeset: - enabled: true +- search +- open-in-new-tab diff --git a/vendor/github.com/vektra/mockery/v2/pkg/config/config.go b/vendor/github.com/vektra/mockery/v2/pkg/config/config.go index 31c5cdbcf..13d457f51 100644 --- a/vendor/github.com/vektra/mockery/v2/pkg/config/config.go +++ b/vendor/github.com/vektra/mockery/v2/pkg/config/config.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "os" - "path/filepath" "reflect" "regexp" "strings" @@ -529,21 +528,6 @@ func isAutoGenerated(path *pathlib.Path) (bool, error) { return false, nil } -func shouldExcludeModule(ctx context.Context, root *pathlib.Path, goModPath *pathlib.Path) (bool, error) { - log := zerolog.Ctx(ctx) - relative, err := goModPath.RelativeTo(root) - if err != nil { - return false, stackerr.NewStackErrf(err, "determining distance from search root") - } - - if len(relative.Parts()) != 1 { - log.Debug().Msg("skipping sub-module") - return true, nil - } - log.Debug().Int("parts_len", len(relative.Parts())).Str("parts", fmt.Sprintf("%v", relative.Parts())).Msg("not skipping module as this is the root path") - return false, nil -} - func (c *Config) subPackages( ctx context.Context, pkgPath string, @@ -603,14 +587,16 @@ func (c *Config) subPackages( pathLog.Debug().Msg("path contains go.mod file") // Check if our current depth is 0. We do this to skip sub-modules, but not // the root module. - shouldExclude, err := shouldExcludeModule(ctx, searchRoot, path) + relative, err := path.RelativeTo(searchRoot) if err != nil { - return err + return stackerr.NewStackErrf(err, "determining distance from search root") } - if shouldExclude { + if len(relative.Parts()) != 1 { + pathLog.Debug().Msg("skipping sub-module") return pathlib.ErrWalkSkipSubtree } + pathLog.Debug().Int("parts_len", len(relative.Parts())).Str("parts", fmt.Sprintf("%v", relative.Parts())).Msg("not skipping module as this is the root path") } _, haveVisitedDir := visitedDirs[path.Parent().String()] @@ -628,22 +614,7 @@ func (c *Config) subPackages( } } - pathLog.Debug().Msg("subdirectory has a .go file") - goModPath := path.Parent().Join("go.mod") - goModExists, err := goModPath.Exists() - if err != nil { - pathLog.Err(err).Msg("failed to determine if go.mod exists") - return err - } - if goModExists { - shouldExclude, err := shouldExcludeModule(ctx, searchRoot, goModPath) - if err != nil { - return err - } - if shouldExclude { - return pathlib.ErrWalkSkipSubtree - } - } + pathLog.Debug().Msg("subdirectory has a .go file, adding this path to packages config") subdirectoriesWithGoFiles = append(subdirectoriesWithGoFiles, path.Parent()) visitedDirs[path.Parent().String()] = nil } @@ -662,7 +633,7 @@ func (c *Config) subPackages( return nil, fmt.Errorf("failed to make subroot relative to root: %w", err) } absolutePackageName := packageRootName.Join(relativeFilesystemPath.Parts()...) - subPackages = append(subPackages, filepath.ToSlash(absolutePackageName.String())) + subPackages = append(subPackages, absolutePackageName.String()) } return subPackages, nil @@ -708,15 +679,8 @@ func (c *Config) discoverRecursivePackages(ctx context.Context) error { subPkgCtx := subPkgLog.WithContext(pkgCtx) if len(conf.Exclude) > 0 { - // pass in the forward-slash as this is a package and the os.PathSeparator - // cannot be used here as it fails on windows. - p := pathlib.NewPath(subPkg, pathlib.PathWithSeperator("/")) - relativePath, err := p.RelativeTo( - pathlib.NewPath( - pkgPath, pathlib.PathWithAfero(p.Fs()), - pathlib.PathWithSeperator("/"), - ), - ) + p := pathlib.NewPath(subPkg) + relativePath, err := p.RelativeToStr(pkgPath) if err != nil { return stackerr.NewStackErrf(err, "failed to get path for %s relative to %s", subPkg, pkgPath) } diff --git a/vendor/github.com/vektra/mockery/v2/pkg/generator.go b/vendor/github.com/vektra/mockery/v2/pkg/generator.go index 23e461c70..85ce89ee5 100644 --- a/vendor/github.com/vektra/mockery/v2/pkg/generator.go +++ b/vendor/github.com/vektra/mockery/v2/pkg/generator.go @@ -196,7 +196,7 @@ func (g *Generator) addPackageImportWithName(ctx context.Context, path, name str log := zerolog.Ctx(ctx) replaced := false g.checkReplaceType(ctx, func(from *replaceType, to *replaceType) bool { - if o != nil && path == from.pkg && (from.typ == "" || o.Name() == from.typ || o.Name() == from.param) { + if o != nil && path == from.pkg && (from.typ == "" || o.Name() == from.typ) { log.Debug().Str("from", path).Str("to", to.pkg).Msg("changing package path") replaced = true path = to.pkg @@ -326,32 +326,10 @@ func (g *Generator) getTypeConstraintString(ctx context.Context) string { return "" } qualifiedParams := make([]string, 0, tp.Len()) -param: for i := 0; i < tp.Len(); i++ { param := tp.At(i) - str := param.String() - typ := g.renderType(ctx, param.Constraint()) - - for _, t := range g.replaceTypeCache { - if str == t.from.param { - // Skip removed generic constraints - if t.from.rmvParam { - continue param - } - - // Import replaced generic constraints - pkg := g.addPackageImportWithName(ctx, t.to.pkg, t.to.alias, param.Obj()) - typ = pkg + "." + t.to.typ - } - } - - qualifiedParams = append(qualifiedParams, fmt.Sprintf("%s %s", str, typ)) - } - - if len(qualifiedParams) == 0 { - return "" + qualifiedParams = append(qualifiedParams, fmt.Sprintf("%s %s", param.String(), g.renderType(ctx, param.Constraint()))) } - return fmt.Sprintf("[%s]", strings.Join(qualifiedParams, ", ")) } @@ -364,21 +342,8 @@ func (g *Generator) getInstantiatedTypeString() string { return "" } params := make([]string, 0, tp.Len()) -param: for i := 0; i < tp.Len(); i++ { - str := tp.At(i).String() - - // Skip replaced generic types - for _, t := range g.replaceTypeCache { - if str == t.from.param && t.from.rmvParam { - continue param - } - } - - params = append(params, str) - } - if len(params) == 0 { - return "" + params = append(params, tp.At(i).String()) } return fmt.Sprintf("[%s]", strings.Join(params, ", ")) } @@ -510,25 +475,7 @@ func (g *Generator) renderType(ctx context.Context, typ types.Type) string { return fmt.Sprintf("%s[%s]", name, strings.Join(args, ",")) case *types.TypeParam: if t.Constraint() != nil { - name := t.Obj().Name() - pkg := "" - - g.checkReplaceType(ctx, func(from *replaceType, to *replaceType) bool { - // Replace with the new type if it is being removed as a constraint - if t.Obj().Pkg().Path() == from.pkg && name == from.param && from.rmvParam { - name = to.typ - if to.pkg != from.pkg { - pkg = g.addPackageImport(ctx, t.Obj().Pkg(), t.Obj()) - } - return false - } - return true - }) - - if pkg != "" { - return pkg + "." + name - } - return name + return t.Obj().Name() } return g.getPackageScopedType(ctx, t.Obj()) case *types.Basic: @@ -559,7 +506,7 @@ func (g *Generator) renderType(ctx context.Context, typ types.Type) string { return fmt.Sprintf( "func(%s)(%s)", g.renderTypeTuple(ctx, t.Params(), t.Variadic()), - g.renderTypeTuple(ctx, t.Results(), false), + g.renderTypeTuple(ctx, t.Results(), t.Variadic()), ) } case *types.Map: @@ -730,7 +677,7 @@ func (g *Generator) genList(ctx context.Context, list *types.Tuple, variadic boo params.Params = append(params.Params, fmt.Sprintf("%s %s", pname, ts)) params.Nilable = append(params.Nilable, isNillable(v.Type())) - if variadic && i == list.Len()-1 { + if strings.Contains(ts, "...") { params.ParamsIntf = append(params.ParamsIntf, fmt.Sprintf("%s ...interface{}", pname)) } else { params.ParamsIntf = append(params.ParamsIntf, fmt.Sprintf("%s interface{}", pname)) @@ -1141,11 +1088,9 @@ func resolveCollision(names []string, variable string) string { } type replaceType struct { - alias string - pkg string - typ string - param string - rmvParam bool + alias string + pkg string + typ string } type replaceTypeItem struct { @@ -1160,14 +1105,6 @@ func parseReplaceType(t string) *replaceType { ret.alias = r[0] t = r[1] } - - // Match type parameter substitution - match := regexp.MustCompile(`\[(.*?)\]$`).FindStringSubmatch(t) - if len(match) >= 2 { - ret.param, ret.rmvParam = strings.CutPrefix(match[1], "-") - t = strings.ReplaceAll(t, match[0], "") - } - lastDot := strings.LastIndex(t, ".") lastSlash := strings.LastIndex(t, "/") if lastDot == -1 || (lastSlash > -1 && lastDot < lastSlash) { diff --git a/vendor/github.com/vektra/mockery/v2/pkg/outputter.go b/vendor/github.com/vektra/mockery/v2/pkg/outputter.go index d35653bc6..1960be9bf 100644 --- a/vendor/github.com/vektra/mockery/v2/pkg/outputter.go +++ b/vendor/github.com/vektra/mockery/v2/pkg/outputter.go @@ -210,7 +210,6 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac data := struct { InterfaceDir string InterfaceDirRelative string - InterfaceFile string InterfaceName string InterfaceNameCamel string InterfaceNameLowerCamel string @@ -223,7 +222,6 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac }{ InterfaceDir: filepath.Dir(iface.FileName), InterfaceDirRelative: interfaceDirRelative, - InterfaceFile: iface.FileName, InterfaceName: iface.Name, // Deprecated: All custom case variables of InterfaceName will be removed in the next major version // Use the template functions instead -- cgit mrf-deployment