From 7dfce4e377847e4ad44bfb1589931922b59de0cc Mon Sep 17 00:00:00 2001 From: zongz Date: Fri, 13 Sep 2024 11:20:33 +0800 Subject: [PATCH 1/3] feat: add loader to load kcl package Signed-off-by: zongz --- .github/workflows/e2e-test.yml | 6 + .github/workflows/test-win.yaml | 6 + .github/workflows/test.yaml | 10 + go.mod | 81 +++++---- go.sum | 171 +++++++++--------- pkg/client/client.go | 100 ++++++---- pkg/client/client_test.go | 10 +- .../test_pkg/expect.mod.lock | 2 +- .../test_pkg/kcl.mod.lock | 2 +- .../test_pkg_win/expect.mod.lock | 2 +- pkg/downloader/source.go | 4 + pkg/features/features.go | 5 +- pkg/loader/loader.go | 154 ++++++++++++++++ pkg/loader/loader_test.go | 126 +++++++++++++ pkg/loader/test_data/test_load_0/kcl.mod | 7 + pkg/loader/test_data/test_load_0/kcl.mod.lock | 0 pkg/loader/test_data/test_load_0/main.k | 1 + pkg/loader/test_data/test_load_1/kcl.mod | 7 + pkg/loader/test_data/test_load_1/kcl.mod.lock | 5 + pkg/loader/test_data/test_load_1/main.k | 1 + pkg/loader/test_data/test_load_2/kcl.mod | 7 + pkg/loader/test_data/test_load_2/kcl.mod.lock | 8 + pkg/loader/test_data/test_load_2/main.k | 1 + pkg/loader/test_data/test_load_3/kcl.mod | 7 + pkg/loader/test_data/test_load_3/kcl.mod.lock | 7 + pkg/loader/test_data/test_load_3/main.k | 1 + pkg/package/package.go | 2 + .../test_suite.stdout | 2 +- .../test_suite.stdout | 2 +- 29 files changed, 566 insertions(+), 171 deletions(-) create mode 100644 pkg/loader/loader.go create mode 100644 pkg/loader/loader_test.go create mode 100644 pkg/loader/test_data/test_load_0/kcl.mod create mode 100644 pkg/loader/test_data/test_load_0/kcl.mod.lock create mode 100644 pkg/loader/test_data/test_load_0/main.k create mode 100644 pkg/loader/test_data/test_load_1/kcl.mod create mode 100644 pkg/loader/test_data/test_load_1/kcl.mod.lock create mode 100644 pkg/loader/test_data/test_load_1/main.k create mode 100644 pkg/loader/test_data/test_load_2/kcl.mod create mode 100644 pkg/loader/test_data/test_load_2/kcl.mod.lock create mode 100644 pkg/loader/test_data/test_load_2/main.k create mode 100644 pkg/loader/test_data/test_load_3/kcl.mod create mode 100644 pkg/loader/test_data/test_load_3/kcl.mod.lock create mode 100644 pkg/loader/test_data/test_load_3/main.k diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 77d60fa9..b268a25b 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -29,3 +29,9 @@ jobs: - name: run e2e run: | make e2e + + - name: Running go tests with coverage and feature gate + env: + KPM_FEATURE_GATES: "SupportPackageLoader=true" + run: | + make e2e diff --git a/.github/workflows/test-win.yaml b/.github/workflows/test-win.yaml index 50b96c12..4e07966e 100644 --- a/.github/workflows/test-win.yaml +++ b/.github/workflows/test-win.yaml @@ -37,3 +37,9 @@ jobs: GO111MODULE: on run : | make cover + - name: Running go tests with coverage on Windows + env: + GO111MODULE: on + KPM_FEATURE_GATES: "SupportPackageLoader=true" + run : | + make cover diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1bb8c00a..313313ad 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -34,3 +34,13 @@ jobs: uses: shogo82148/actions-goveralls@v1 with: path-to-profile: coverage.out + - name: Running go tests with coverage and feature gate + env: + GO111MODULE: on + KPM_FEATURE_GATES: "SupportPackageLoader=true" + run: | + make cover + - name: Send coverage + uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: coverage.out diff --git a/go.mod b/go.mod index 9651ea66..31e65b5b 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/opencontainers/image-spec v1.1.0 github.com/otiai10/copy v1.14.0 github.com/sirupsen/logrus v1.9.3 - github.com/urfave/cli/v2 v2.25.0 + github.com/urfave/cli/v2 v2.27.4 golang.org/x/mod v0.21.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools/v3 v3.5.1 @@ -20,16 +20,18 @@ require ( ) require ( - cloud.google.com/go v0.112.1 // indirect - cloud.google.com/go/compute/metadata v0.3.0 // indirect - cloud.google.com/go/iam v1.1.6 // indirect - cloud.google.com/go/storage v1.38.0 // indirect - dario.cat/mergo v1.0.0 // indirect - github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect + cloud.google.com/go v0.115.1 // indirect + cloud.google.com/go/auth v0.9.4 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect + cloud.google.com/go/compute/metadata v0.5.1 // indirect + cloud.google.com/go/iam v1.2.1 // indirect + cloud.google.com/go/storage v1.43.0 // indirect + dario.cat/mergo v1.0.1 // indirect + github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/ProtonMail/go-crypto v1.0.0 // indirect - github.com/aws/aws-sdk-go v1.44.122 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -38,26 +40,26 @@ require ( github.com/chai2010/jsonv v1.1.3 // indirect github.com/chai2010/protorpc v1.1.4 // indirect github.com/chainguard-dev/git-urls v1.0.2 // indirect - github.com/cloudflare/circl v1.3.7 // indirect - github.com/containerd/containerd v1.7.20 // indirect - github.com/containerd/errdefs v0.1.0 // indirect + github.com/cloudflare/circl v1.4.0 // indirect + github.com/containerd/containerd v1.7.22 // indirect + github.com/containerd/errdefs v0.2.0 // indirect github.com/containerd/log v0.1.0 // indirect github.com/containerd/platforms v0.2.1 // indirect github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 // indirect github.com/containers/ocicrypt v1.2.0 // indirect github.com/containers/storage v1.55.0 // indirect - github.com/cyphar/filepath-securejoin v0.3.1 // indirect + github.com/cyphar/filepath-securejoin v0.3.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/docker/cli v27.1.1+incompatible // indirect + github.com/docker/cli v27.2.1+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v27.1.1+incompatible // indirect + github.com/docker/docker v27.2.1+incompatible // indirect github.com/docker/docker-credential-helpers v0.8.2 // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/proto v1.13.2 // indirect github.com/emirpasic/gods v1.18.1 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/getkin/kin-openapi v0.127.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect @@ -72,10 +74,10 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect - github.com/google/s2a-go v0.1.7 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect - github.com/googleapis/gax-go/v2 v2.12.2 // indirect + github.com/google/pprof v0.0.0-20240910150728-a0b0bb1d4134 // indirect + github.com/google/s2a-go v0.1.8 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect + github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect @@ -88,14 +90,14 @@ require ( github.com/klauspost/compress v1.17.9 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moby/locker v1.0.1 // indirect github.com/moby/sys/mountinfo v0.7.2 // indirect - github.com/moby/sys/user v0.2.0 // indirect + github.com/moby/sys/user v0.3.0 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect @@ -105,52 +107,51 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/powerman/rpc-codec v1.2.2 // indirect - github.com/prometheus/client_golang v1.20.0 // indirect + github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.59.1 // indirect github.com/prometheus/procfs v0.15.1 // indirect - github.com/protocolbuffers/txtpbfmt v0.0.0-20240416193709-1e18ef0a7fdc // indirect + github.com/protocolbuffers/txtpbfmt v0.0.0-20240823084532-8e6b51fa9bef // indirect github.com/qri-io/jsonpointer v0.1.1 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect - github.com/skeema/knownhosts v1.2.2 // indirect + github.com/skeema/knownhosts v1.3.0 // indirect github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect github.com/ulikunitz/xz v0.5.12 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/yuin/goldmark v1.7.4 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect + go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect - go.opentelemetry.io/otel/sdk v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect golang.org/x/crypto v0.27.0 // indirect - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/net v0.29.0 // indirect - golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.6.0 // indirect golang.org/x/tools v0.25.0 // indirect - golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/api v0.169.0 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect + google.golang.org/api v0.197.0 // indirect + google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/grpc v1.66.2 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect + k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 // indirect kcl-lang.io/lib v0.10.0 // indirect ) require ( - github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/go-git/go-git/v5 v5.12.0 github.com/gofrs/flock v0.12.1 github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 diff --git a/go.sum b/go.sum index 1e94ed6f..a54a4fed 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.112.1 h1:uJSeirPke5UNZHIb4SxfZklVSiWWVqW4oXlETwZziwM= -cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= +cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= +cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -46,6 +46,10 @@ cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjby cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/auth v0.9.4 h1:DxF7imbEbiFu9+zdKC6cKBko1e8XeJnipNqIbWZ+kDI= +cloud.google.com/go/auth v0.9.4/go.mod h1:SHia8n6//Ya940F1rLimhJCjjx7KE17t0ctFEci3HkA= +cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= +cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -68,8 +72,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.1 h1:NM6oZeZNlYjiwYje+sYFjEpP0Q0zCan1bmQW/KmIrGs= +cloud.google.com/go/compute/metadata v0.5.1/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= @@ -107,12 +111,14 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= -cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= +cloud.google.com/go/iam v1.2.1 h1:QFct02HRb7H12J/3utj0qf5tobFh9V4vR6h9eX5EBRU= +cloud.google.com/go/iam v1.2.1/go.mod h1:3VUIJDPpwT6p/amXRC5GY8fCCh70lxPygguVtI0Z4/g= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/longrunning v0.6.0 h1:mM1ZmaNsQsnb+5n1DNPeL0KwQd9jQRqSqSDEkBZr+aI= +cloud.google.com/go/longrunning v0.6.0/go.mod h1:uHzSZqW89h7/pasCWNYdUpwGz3PcVWhrWupreVPYLts= cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= @@ -169,8 +175,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.38.0 h1:Az68ZRGlnNTpIBbLjSMIV2BDcwwXYlRlQzis0llkpJg= -cloud.google.com/go/storage v1.38.0/go.mod h1:tlUADB0mAb9BgYls9lq+8MGkfzOXuLrnHXlpHmvFJoY= +cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= +cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= @@ -182,11 +188,11 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -208,8 +214,9 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuW github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/aws/aws-sdk-go v1.44.122 h1:p6mw01WBaNpbdP2xrisz5tIkcNwzj/HysobNoaAHjgo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -242,8 +249,8 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= -github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cloudflare/circl v1.4.0 h1:BV7h5MgrktNzytKmWjpOtdYrf0lkkbF8YMlBGPhJQrY= +github.com/cloudflare/circl v1.4.0/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -256,12 +263,12 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGDJ9kip0= github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0= -github.com/containerd/containerd v1.7.20 h1:Sl6jQYk3TRavaU83h66QMbI2Nqg9Jm6qzwX57Vsn1SQ= -github.com/containerd/containerd v1.7.20/go.mod h1:52GsS5CwquuqPuLncsXwG0t2CiUce+KsNHJZQJvAgR0= +github.com/containerd/containerd v1.7.22 h1:nZuNnNRA6T6jB975rx2RRNqqH2k6ELYKDZfqTHqwyy0= +github.com/containerd/containerd v1.7.22/go.mod h1:e3Jz1rYRUZ2Lt51YrH9Rz0zPyJBOlSvB3ghr2jbVD8g= github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM= github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= -github.com/containerd/errdefs v0.1.0 h1:m0wCRBiu1WJT/Fr+iOoQHMQS/eP5myQ8lCv4Dz5ZURM= -github.com/containerd/errdefs v0.1.0/go.mod h1:YgWiiHtLmSeBrvpw+UfPijzbLaB77mEG1WwJTDETIV0= +github.com/containerd/errdefs v0.2.0 h1:XllDESRfJtVrMwMmR2mCabxyvBK4UlbyyiWI3MvRw0o= +github.com/containerd/errdefs v0.2.0/go.mod h1:C28ixlj3dKhQS9hsQ13b+HIb4X7+s2G4FYhbSPcRDLM= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= @@ -276,12 +283,12 @@ github.com/containers/storage v1.55.0 h1:wTWZ3YpcQf1F+dSP4KxG9iqDfpQY1otaUXjPpff github.com/containers/storage v1.55.0/go.mod h1:28cB81IDk+y7ok60Of6u52RbCeBRucbFOeLunhER1RQ= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= -github.com/cyphar/filepath-securejoin v0.3.1 h1:1V7cHiaW+C+39wEfpH6XlLBQo3j/PciWFrgfCLS8XrE= -github.com/cyphar/filepath-securejoin v0.3.1/go.mod h1:F7i41x/9cBF7lzCrVsYs9fuzwRZm4NQsGTBdpp6mETc= +github.com/cyphar/filepath-securejoin v0.3.2 h1:QhZu5AxQ+o1XZH0Ye05YzvJ0kAdK6VQc0z9NNMek7gc= +github.com/cyphar/filepath-securejoin v0.3.2/go.mod h1:F7i41x/9cBF7lzCrVsYs9fuzwRZm4NQsGTBdpp6mETc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -292,12 +299,12 @@ github.com/distribution/distribution/v3 v3.0.0-beta.1 h1:X+ELTxPuZ1Xe5MsD3kp2wfG github.com/distribution/distribution/v3 v3.0.0-beta.1/go.mod h1:O9O8uamhHzWWQVTjuQpyYUVm/ShPHPUDgvQMpHGVBDs= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/cli v27.1.1+incompatible h1:goaZxOqs4QKxznZjjBWKONQci/MywhtRv2oNn0GkeZE= -github.com/docker/cli v27.1.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v27.2.1+incompatible h1:U5BPtiD0viUzjGAjV1p0MGB8eVA3L3cbIrnyWmSJI70= +github.com/docker/cli v27.2.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v27.1.1+incompatible h1:hO/M4MtV36kzKldqnA37IWhebRA+LnqqcqDja6kVaKY= -github.com/docker/docker v27.1.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.2.1+incompatible h1:fQdiLfW7VLscyoeYEBz7/J8soYFDZV1u6VW6gJEjNMI= +github.com/docker/docker v27.2.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo= github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= @@ -331,8 +338,8 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/getkin/kin-openapi v0.127.0 h1:Mghqi3Dhryf3F8vR370nN67pAERW+3a95vomb3MAREY= @@ -444,8 +451,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -460,11 +467,11 @@ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20240910150728-a0b0bb1d4134 h1:c5FlPPgxOn7kJz3VoPLkQYQXGBS3EklQ4Zfi57uOuqQ= +github.com/google/pprof v0.0.0-20240910150728-a0b0bb1d4134/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= +github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -472,8 +479,8 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= +github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -483,8 +490,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.2 h1:mhN09QQW1jEWeMF74zGR81R30z4VJzjZsfkUhuHF+DA= -github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= +github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= +github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= @@ -565,8 +572,8 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -581,8 +588,10 @@ github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg= github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4= -github.com/moby/sys/user v0.2.0 h1:OnpapJsRp25vkhw8TFG6OLJODNh/3rEwRWtJ3kakwRM= -github.com/moby/sys/user v0.2.0/go.mod h1:RYstrcWOJpVh+6qzUqp2bU3eaRpdiQeKGlKitaH0PM8= +github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= +github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -628,8 +637,8 @@ github.com/powerman/rpc-codec v1.2.2/go.mod h1:3Qr/y/+u3CwcSww9tfJMRn/95lB2qUdUe github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= -github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI= -github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -637,15 +646,15 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= +github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/protocolbuffers/txtpbfmt v0.0.0-20240416193709-1e18ef0a7fdc h1:DRZwH75/E4a2SOr7+gKZ99OEhmjzBzAhgyTnzo1TepY= -github.com/protocolbuffers/txtpbfmt v0.0.0-20240416193709-1e18ef0a7fdc/go.mod h1:jgxiZysxFPM+iWKwQwPR+y+Jvo54ARd4EisXxKYpB5c= +github.com/protocolbuffers/txtpbfmt v0.0.0-20240823084532-8e6b51fa9bef h1:ej+64jiny5VETZTqcc1GFVAPEtaSk6U1D0kKC2MS5Yc= +github.com/protocolbuffers/txtpbfmt v0.0.0-20240823084532-8e6b51fa9bef/go.mod h1:jgxiZysxFPM+iWKwQwPR+y+Jvo54ARd4EisXxKYpB5c= github.com/qri-io/jsonpointer v0.1.1 h1:prVZBZLL6TW5vsSB9fFHFAMBLI4b0ri5vribQlTJiBA= github.com/qri-io/jsonpointer v0.1.1/go.mod h1:DnJPaYgiKu56EuDp8TU5wFLdZIcAnb/uH9v37ZaMV64= github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 h1:EaDatTxkdHG+U3Bk4EUr+DZ7fOGwTfezUiUJMaIcaho= @@ -666,8 +675,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= -github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= +github.com/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY= +github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= @@ -697,8 +706,8 @@ github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95 github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/urfave/cli/v2 v2.25.0 h1:ykdZKuQey2zq0yin/l7JOm9Mh+pg72ngYMeB0ABn6q8= -github.com/urfave/cli/v2 v2.25.0/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8= +github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ= github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= @@ -726,12 +735,12 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/exporters/autoexport v0.46.1 h1:ysCfPZB9AjUlMa1UHYup3c9dAOCMQX/6sxSfPBUoxHw= go.opentelemetry.io/contrib/exporters/autoexport v0.46.1/go.mod h1:ha0aiYm+DOPsLHjh0zoQ8W8sLT+LJ58J3j47lGpSLrU= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 h1:4K4tsIXefpVJtvA/8srF4V4y0akAoPHkIslgAkjixJA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0/go.mod h1:jjdQuTGVsXV4vSs+CJ2qYDeDPf9yIJV23qlIzBm73Vg= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 h1:hCq2hNMwsegUvPzI7sPOvtO9cqyy5GbWt/Ybp2xrx8Q= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0/go.mod h1:LqaApwGx/oUmzsbqxkzuBvyoPpkxk3JQWnqfVrJ3wCA= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 h1:ZIg3ZT/aQ7AfKqdwp7ECpOK6vHqquXXuyTjIO8ZdmPs= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0/go.mod h1:DQAwmETtZV00skUwgD6+0U89g80NKsJE3DCKeLLPQMI= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0 h1:jd0+5t/YynESZqsSyPz+7PAFdEop0dlN0+PkyHYo8oI= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0/go.mod h1:U707O40ee1FpQGyhvqnzmCJm1Wh6OX6GGBVn0E6Uyyk= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0 h1:bflGWrfYyuulcdxf14V6n9+CoQcu5SAAdHmDPAJnlps= @@ -748,14 +757,14 @@ go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0 h1:dEZWPjVN22urgY go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0/go.mod h1:sTt30Evb7hJB/gEk27qLb1+l9n4Tb8HvHkR0Wx3S6CU= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 h1:VhlEQAPp9R1ktYfrPk5SOryw1e9LDDTZCbIPFrho0ec= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0/go.mod h1:kB3ufRbfU+CQ4MlUcqtW8Z7YEOBeK2DJ6CmR5rYYF3E= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= -go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= +go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= go.opentelemetry.io/otel/sdk/metric v1.21.0 h1:smhI5oD714d6jHE6Tie36fPx4WDFIg+Y6RfAY4ICcR0= go.opentelemetry.io/otel/sdk/metric v1.21.0/go.mod h1:FJ8RAsoPGv/wYMgBdUJXOm+6pzFY3YdljnXtv1SBE8Q= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= @@ -781,8 +790,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -892,8 +901,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1077,8 +1086,8 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T 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= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= +golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da h1:noIWHXmPHxILtqtCOPIhSt0ABwskkZKjD3bXGnZGpNY= +golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1127,8 +1136,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY= -google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= +google.golang.org/api v0.197.0 h1:x6CwqQLsFiA5JKAiGyGBjc2bNtHtLddhJCE2IKuhhcQ= +google.golang.org/api v0.197.0/go.mod h1:AuOuo20GoQ331nq7DquGHlU6d+2wN2fZ8O0ta60nRNw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1237,12 +1246,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= -google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= +google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:hL97c3SYopEHblzpxRL4lSs523++l8DYxGM1FQiYmb4= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1326,8 +1335,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= -k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 h1:b2FmK8YH+QEwq/Sy2uAEhmqL5nPfGYbJOcaqjeYYZoA= +k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= kcl-lang.io/kcl-go v0.10.1 h1:2YXQP5QcwNGVLnxdcTNLRoJkYn357gCgqbgU+8hVHxU= kcl-lang.io/kcl-go v0.10.1/go.mod h1:AQIQplXxCpodSw1Kt+qiFvIB7tzBQ18djT2GytS33nM= kcl-lang.io/lib v0.10.0 h1:VLwZTMfRZyaGfIJc8qxLn7bKr24PSgZLc3SxMRxUaN4= diff --git a/pkg/client/client.go b/pkg/client/client.go index 493c4e4f..51ed62c4 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -30,6 +30,7 @@ import ( "kcl-lang.io/kpm/pkg/errors" "kcl-lang.io/kpm/pkg/features" "kcl-lang.io/kpm/pkg/git" + "kcl-lang.io/kpm/pkg/loader" "kcl-lang.io/kpm/pkg/oci" "kcl-lang.io/kpm/pkg/opt" pkg "kcl-lang.io/kpm/pkg/package" @@ -41,6 +42,8 @@ import ( // KpmClient is the client of kpm. type KpmClient struct { + // The loader of the kcl package. + PkgLoader loader.Loader // The writer of the log. logWriter io.Writer // The downloader of the dependencies. @@ -76,6 +79,7 @@ func NewKpmClient() (*KpmClient, error) { logWriter: os.Stdout, settings: *settings, homePath: homePath, + PkgLoader: loader.NewFileLoader(settings), DepDownloader: &downloader.DepDownloader{}, }, nil } @@ -151,49 +155,53 @@ func (c *KpmClient) GetSettings() *settings.Settings { } func (c *KpmClient) LoadPkgFromPath(pkgPath string) (*pkg.KclPkg, error) { - modFile, err := c.LoadModFile(pkgPath) - if err != nil { - return nil, reporter.NewErrorEvent(reporter.FailedLoadKclMod, err, fmt.Sprintf("could not load 'kcl.mod' in '%s'", pkgPath)) - } - - // Get dependencies from kcl.mod.lock. - deps, err := c.LoadLockDeps(pkgPath) + if ok, err := features.Enabled(features.SupportPackageLoader); err != nil && ok { + return c.PkgLoader.Load(pkgPath) + } else { + modFile, err := c.LoadModFile(pkgPath) + if err != nil { + return nil, reporter.NewErrorEvent(reporter.FailedLoadKclMod, err, fmt.Sprintf("could not load 'kcl.mod' in '%s'", pkgPath)) + } - if err != nil { - return nil, reporter.NewErrorEvent(reporter.FailedLoadKclMod, err, fmt.Sprintf("could not load 'kcl.mod.lock' in '%s'", pkgPath)) - } + // Get dependencies from kcl.mod.lock. + deps, err := c.LoadLockDeps(pkgPath) - // Align the dependencies between kcl.mod and kcl.mod.lock. - for _, name := range modFile.Dependencies.Deps.Keys() { - dep, ok := modFile.Dependencies.Deps.Get(name) - if !ok { - break + if err != nil { + return nil, reporter.NewErrorEvent(reporter.FailedLoadKclMod, err, fmt.Sprintf("could not load 'kcl.mod.lock' in '%s'", pkgPath)) } - if dep.Local != nil { - if ldep, ok := deps.Deps.Get(name); ok { - var localFullPath string - if filepath.IsAbs(dep.Local.Path) { - localFullPath = dep.Local.Path - } else { - localFullPath, err = filepath.Abs(filepath.Join(pkgPath, dep.Local.Path)) - if err != nil { - return nil, reporter.NewErrorEvent(reporter.Bug, err, "internal bugs, please contact us to fix it.") + + // Align the dependencies between kcl.mod and kcl.mod.lock. + for _, name := range modFile.Dependencies.Deps.Keys() { + dep, ok := modFile.Dependencies.Deps.Get(name) + if !ok { + break + } + if dep.Local != nil { + if ldep, ok := deps.Deps.Get(name); ok { + var localFullPath string + if filepath.IsAbs(dep.Local.Path) { + localFullPath = dep.Local.Path + } else { + localFullPath, err = filepath.Abs(filepath.Join(pkgPath, dep.Local.Path)) + if err != nil { + return nil, reporter.NewErrorEvent(reporter.Bug, err, "internal bugs, please contact us to fix it.") + } } + ldep.LocalFullPath = localFullPath + dep.LocalFullPath = localFullPath + ldep.Source = dep.Source + deps.Deps.Set(name, ldep) + modFile.Dependencies.Deps.Set(name, dep) } - ldep.LocalFullPath = localFullPath - dep.LocalFullPath = localFullPath - ldep.Source = dep.Source - deps.Deps.Set(name, ldep) - modFile.Dependencies.Deps.Set(name, dep) } } - } - return &pkg.KclPkg{ - ModFile: *modFile, - HomePath: pkgPath, - Dependencies: *deps, - }, nil + return &pkg.KclPkg{ + ModFile: *modFile, + HomePath: pkgPath, + Dependencies: *deps, + }, nil + } } func (c *KpmClient) LoadModFile(pkgPath string) (*pkg.ModFile, error) { @@ -1177,8 +1185,6 @@ func (c *KpmClient) Download(dep *pkg.Dependency, homePath, localPath string) (* return nil, err } - dep.FullName = dep.GenDepFullName() - if dep.GetPackage() != "" { localFullPath, err := utils.FindPackage(localPath, dep.GetPackage()) if err != nil { @@ -1190,11 +1196,12 @@ func (c *KpmClient) Download(dep *pkg.Dependency, homePath, localPath string) (* dep.LocalFullPath = localPath } - modFile, err := c.LoadModFile(dep.LocalFullPath) + dpkg, err := c.LoadPkgFromPath(dep.LocalFullPath) if err != nil { return nil, err } - dep.Version = modFile.Pkg.Version + + dep.FromKclPkg(dpkg) } if dep.Source.Oci != nil || dep.Source.Registry != nil { @@ -1832,7 +1839,22 @@ func (c *KpmClient) DownloadDeps(deps *pkg.Dependencies, lockDeps *pkg.Dependenc existDep, err := c.dependencyExistsLocal(pkghome, &d) if existDep != nil && err == nil { + + if d.GetPackage() != "" { + existDep.LocalFullPath, err = utils.FindPackage(existDep.LocalFullPath, d.GetPackage()) + if err != nil { + return nil, err + } + } + + dpkg, err := c.LoadPkgFromPath(existDep.LocalFullPath) + if err != nil { + return nil, err + } + + existDep.FromKclPkg(dpkg) newDeps.Deps.Set(d.Name, *existDep) + deps.Deps.Set(d.Name, *existDep) continue } diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index a60b5639..de98d65a 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -153,7 +153,7 @@ func TestDownloadGitWithPackage(t *testing.T) { } }() - err := os.MkdirAll(testPath, 0755) + err := os.MkdirAll(getTestDir("download"), 0755) assert.Equal(t, err, nil) depFromGit := pkg.Dependency{ @@ -161,9 +161,9 @@ func TestDownloadGitWithPackage(t *testing.T) { Version: "", Source: downloader.Source{ Git: &downloader.Git{ - Url: "https://github.com/kcl-lang/modules.git", - Commit: "bdd4d00a88bc3534ae50affa8328df2927fd2171", - Package: "add-ndots", + Url: "https://github.com/kcl-lang/flask-demo-kcl-manifests", + Commit: "8308200", + Package: "cc", }, }, } @@ -174,7 +174,7 @@ func TestDownloadGitWithPackage(t *testing.T) { dep, err := kpmcli.Download(&depFromGit, "", testPath) assert.Equal(t, err, nil) - assert.Equal(t, dep.Source.Git.Package, "add-ndots") + assert.Equal(t, dep.Source.Git.Package, "cc") } func TestModandLockFilesWithGitPackageDownload(t *testing.T) { diff --git a/pkg/client/test_data/test_mod_file_package/test_pkg/expect.mod.lock b/pkg/client/test_data/test_mod_file_package/test_pkg/expect.mod.lock index 32355765..2d3841c0 100644 --- a/pkg/client/test_data/test_mod_file_package/test_pkg/expect.mod.lock +++ b/pkg/client/test_data/test_mod_file_package/test_pkg/expect.mod.lock @@ -1,7 +1,7 @@ [dependencies] [dependencies.cc] name = "cc" - full_name = "flask-demo-kcl-manifests_8308200" + full_name = "cc_0.0.1" version = "0.0.1" url = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git" commit = "8308200" diff --git a/pkg/client/test_data/test_mod_file_package/test_pkg/kcl.mod.lock b/pkg/client/test_data/test_mod_file_package/test_pkg/kcl.mod.lock index c29fb868..32355765 100644 --- a/pkg/client/test_data/test_mod_file_package/test_pkg/kcl.mod.lock +++ b/pkg/client/test_data/test_mod_file_package/test_pkg/kcl.mod.lock @@ -1,7 +1,7 @@ [dependencies] [dependencies.cc] name = "cc" - full_name = "flask_manifests_0.0.1" + full_name = "flask-demo-kcl-manifests_8308200" version = "0.0.1" url = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git" commit = "8308200" diff --git a/pkg/client/test_data/test_mod_file_package/test_pkg_win/expect.mod.lock b/pkg/client/test_data/test_mod_file_package/test_pkg_win/expect.mod.lock index 32355765..2d3841c0 100644 --- a/pkg/client/test_data/test_mod_file_package/test_pkg_win/expect.mod.lock +++ b/pkg/client/test_data/test_mod_file_package/test_pkg_win/expect.mod.lock @@ -1,7 +1,7 @@ [dependencies] [dependencies.cc] name = "cc" - full_name = "flask-demo-kcl-manifests_8308200" + full_name = "cc_0.0.1" version = "0.0.1" url = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git" commit = "8308200" diff --git a/pkg/downloader/source.go b/pkg/downloader/source.go index 7c173a74..27a71fd4 100644 --- a/pkg/downloader/source.go +++ b/pkg/downloader/source.go @@ -22,6 +22,10 @@ type Source struct { *Local `toml:"-"` } +func (source *Source) IsNilSource() bool { + return source == nil || (source.Git == nil && source.Oci == nil && source.Local == nil && source.Registry == nil) +} + type Local struct { Path string `toml:"path,omitempty"` } diff --git a/pkg/features/features.go b/pkg/features/features.go index 98e4dd94..842d5679 100644 --- a/pkg/features/features.go +++ b/pkg/features/features.go @@ -10,10 +10,13 @@ import ( const ( // SupportMVS is the feature gate for enabling the support for MVS. SupportMVS = "SupportMVS" + // SupportPackageLoader is the feature gate for enabling the support for package loader. + SupportPackageLoader = "SupportPackageLoader" ) var features = map[string]bool{ - SupportMVS: false, + SupportMVS: false, + SupportPackageLoader: false, } func init() { diff --git a/pkg/loader/loader.go b/pkg/loader/loader.go new file mode 100644 index 00000000..c4a63973 --- /dev/null +++ b/pkg/loader/loader.go @@ -0,0 +1,154 @@ +package loader + +import ( + "fmt" + "path/filepath" + + "github.com/elliotchance/orderedmap/v2" + "kcl-lang.io/kpm/pkg/downloader" + pkg "kcl-lang.io/kpm/pkg/package" + "kcl-lang.io/kpm/pkg/settings" + "kcl-lang.io/kpm/pkg/utils" +) + +// Loader is an interface that defines the method to load a package. +type Loader interface { + Load(pkgPath string) (*pkg.KclPkg, error) +} + +// PkgLoader is a struct that contains the settings. +type PkgLoader struct { + settings *settings.Settings +} + +// NewPkgLoader creates a new PkgLoader. +func NewPkgLoader(settings *settings.Settings) *PkgLoader { + return &PkgLoader{ + settings: settings, + } +} + +// FileLoader is a struct that load a package from the file system. +type FileLoader struct { + PkgLoader +} + +// NewFileLoader creates a new FileLoader. +func NewFileLoader(settings *settings.Settings) *FileLoader { + return &FileLoader{ + PkgLoader: PkgLoader{ + settings: settings, + }, + } +} + +// loadModFile loads the kcl.mod file from the package path. +func (fl *FileLoader) loadModFile(pkgPath string) (*pkg.ModFile, error) { + modFile := new(pkg.ModFile) + err := modFile.LoadModFile(filepath.Join(pkgPath, pkg.MOD_FILE)) + if err != nil { + return nil, fmt.Errorf("failed to load the mod file: %w", err) + } + modFile.HomePath = pkgPath + if modFile.Dependencies.Deps == nil { + modFile.Dependencies.Deps = orderedmap.NewOrderedMap[string, pkg.Dependency]() + } + return modFile, nil +} + +// preProcess pre-processes the package loaded from kcl.mod and kcl.mod.lock +// 1. transform the local path to the absolute path. +// 2. fill the default oci registry. +func (fl *FileLoader) preProcess(kpkg *pkg.KclPkg) error { + for _, name := range kpkg.ModFile.Dependencies.Deps.Keys() { + dep, ok := kpkg.ModFile.Dependencies.Deps.Get(name) + if !ok { + break + } + // Transform the local path to the absolute path. + if dep.Local != nil { + var localFullPath string + var err error + if filepath.IsAbs(dep.Local.Path) { + localFullPath = dep.Local.Path + } else { + localFullPath, err = filepath.Abs(filepath.Join(kpkg.HomePath, dep.Local.Path)) + if err != nil { + return fmt.Errorf("failed to get the absolute path of the local dependency %s: %w", name, err) + } + } + dep.LocalFullPath = localFullPath + kpkg.ModFile.Dependencies.Deps.Set(name, dep) + } + // Fill the default oci registry. + if dep.Source.Oci != nil { + if len(dep.Source.Oci.Reg) == 0 { + dep.Source.Oci.Reg = fl.settings.DefaultOciRegistry() + } + + if len(dep.Source.Oci.Repo) == 0 { + urlpath := utils.JoinPath(fl.settings.DefaultOciRepo(), dep.Name) + dep.Source.Oci.Repo = urlpath + } + } + if dep.Source.Registry != nil { + if len(dep.Source.Registry.Reg) == 0 { + dep.Source.Registry.Reg = fl.settings.DefaultOciRegistry() + } + + if len(dep.Source.Registry.Repo) == 0 { + urlpath := utils.JoinPath(fl.settings.DefaultOciRepo(), dep.Name) + dep.Source.Registry.Repo = urlpath + } + + dep.Version = dep.Source.Registry.Version + } + if dep.Source.IsNilSource() { + dep.Source.Registry = &downloader.Registry{ + Name: dep.Name, + Version: dep.Version, + Oci: &downloader.Oci{ + Reg: fl.settings.DefaultOciRegistry(), + Repo: utils.JoinPath(fl.settings.DefaultOciRepo(), dep.Name), + Tag: dep.Version, + }, + } + } + kpkg.ModFile.Dependencies.Deps.Set(name, dep) + if lockDep, ok := kpkg.Dependencies.Deps.Get(name); ok { + lockDep.Source = dep.Source + kpkg.Dependencies.Deps.Set(name, lockDep) + } + } + + return nil +} + +// Load loads a package from the file system. +func (fl *FileLoader) Load(pkgPath string) (*pkg.KclPkg, error) { + modFile, err := fl.loadModFile(pkgPath) + if err != nil { + return nil, fmt.Errorf("failed to load the package from the path %s: %w", pkgPath, err) + } + + // load the kcl.mod.lock file. + // Get dependencies from kcl.mod.lock. + deps, err := pkg.LoadLockDeps(pkgPath) + if err != nil { + return nil, fmt.Errorf("failed to load the package from the path %s: %w", pkgPath, err) + } + + kpkg := &pkg.KclPkg{ + ModFile: *modFile, + HomePath: pkgPath, + Dependencies: *deps, + } + + // pre-process the package. + err = fl.preProcess(kpkg) + if err != nil { + return nil, fmt.Errorf("failed to load the package from the path %s: %w", pkgPath, err) + } + + return kpkg, nil +} diff --git a/pkg/loader/loader_test.go b/pkg/loader/loader_test.go new file mode 100644 index 00000000..bac87d21 --- /dev/null +++ b/pkg/loader/loader_test.go @@ -0,0 +1,126 @@ +package loader + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/assert" + pkg "kcl-lang.io/kpm/pkg/package" + "kcl-lang.io/kpm/pkg/settings" +) + +const testDataDir = "test_data" + +func getTestDir(subDir string) string { + pwd, _ := os.Getwd() + testDir := filepath.Join(pwd, testDataDir) + testDir = filepath.Join(testDir, subDir) + + return testDir +} + +func load(t *testing.T, pkgPath string) *pkg.KclPkg { + loader := NewFileLoader(settings.GetSettings()) + pkg, err := loader.Load(pkgPath) + if err != nil { + t.Fatal(err) + } + + if pkg == nil { + t.Fatal("pkg is nil") + } + return pkg +} + +// Test the section [package] loaded from kcl.mod +func TestLoadPackage(t *testing.T) { + pkgPath := getTestDir("test_load_0") + pkg := load(t, pkgPath) + + assert.Equal(t, pkg.HomePath, pkgPath) + assert.Equal(t, pkg.ModFile.Pkg.Name, "test_load_0") + assert.Equal(t, pkg.ModFile.Pkg.Version, "0.0.1") + assert.ElementsMatch(t, pkg.ModFile.Pkg.Include, []string{"src/**/include.k"}) + assert.ElementsMatch(t, pkg.ModFile.Pkg.Exclude, []string{"src/**/excluded.k"}) + assert.Equal(t, pkg.ModFile.Pkg.Description, "A test package for the loader") + assert.Equal(t, pkg.ModFile.Dependencies.Deps.Len(), 0) +} + +// Test load the dependency +// 'helloworld = 0.1.2' +func TestLoadDefaultDep(t *testing.T) { + pkgPath := getTestDir("test_load_1") + pkg := load(t, pkgPath) + + assert.Equal(t, pkg.Dependencies.Deps.Len(), 1) + assert.Equal(t, pkg.ModFile.Dependencies.Deps.Len(), 1) + + // test dep from kcl.mod + dep, _ := pkg.Dependencies.Deps.Get("helloworld") + assert.Equal(t, dep.Name, "helloworld") + assert.Equal(t, dep.FullName, "helloworld_0.1.2") + assert.Equal(t, dep.Version, "0.1.2") + assert.Equal(t, dep.Source.Registry.Oci.Reg, "ghcr.io") + assert.Equal(t, dep.Source.Registry.Oci.Repo, "kcl-lang/helloworld") + + // test dep from kcl.mod.lock + dep, _ = pkg.Dependencies.Deps.Get("helloworld") + assert.Equal(t, dep.Name, "helloworld") + assert.Equal(t, dep.FullName, "helloworld_0.1.2") + assert.Equal(t, dep.Version, "0.1.2") + assert.Equal(t, dep.Source.Registry.Oci.Reg, "ghcr.io") + assert.Equal(t, dep.Source.Registry.Oci.Repo, "kcl-lang/helloworld") +} + +// Test load the dependency +// 'helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.1" }' +func TestLoadOciDep(t *testing.T) { + pkgPath := getTestDir("test_load_2") + pkg := load(t, pkgPath) + + assert.Equal(t, pkg.Dependencies.Deps.Len(), 1) + assert.Equal(t, pkg.ModFile.Dependencies.Deps.Len(), 1) + + // test dep from kcl.mod + dep, _ := pkg.Dependencies.Deps.Get("helloworld") + assert.Equal(t, dep.Name, "helloworld") + assert.Equal(t, dep.FullName, "helloworld_0.1.1") + assert.Equal(t, dep.Version, "0.1.1") + assert.Equal(t, dep.Source.Oci.Reg, "ghcr.io") + assert.Equal(t, dep.Source.Oci.Repo, "kcl-lang/helloworld") + + // test dep from kcl.mod.lock + dep, _ = pkg.Dependencies.Deps.Get("helloworld") + assert.Equal(t, dep.Name, "helloworld") + assert.Equal(t, dep.FullName, "helloworld_0.1.1") + assert.Equal(t, dep.Version, "0.1.1") + assert.Equal(t, dep.Source.Oci.Reg, "ghcr.io") + assert.Equal(t, dep.Source.Oci.Repo, "kcl-lang/helloworld") +} + +// Test load the dependency +// flask-demo-kcl-manifests = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git", commit = "ade147b" } +func TestLoadGitDep(t *testing.T) { + pkgPath := getTestDir("test_load_3") + pkg := load(t, pkgPath) + + assert.Equal(t, pkg.Dependencies.Deps.Len(), 1) + assert.Equal(t, pkg.ModFile.Dependencies.Deps.Len(), 1) + + // test dep from kcl.mod + dep, _ := pkg.ModFile.Dependencies.Deps.Get("flask-demo-kcl-manifests") + assert.Equal(t, dep.Name, "flask-demo-kcl-manifests") + assert.Equal(t, dep.FullName, "flask-demo-kcl-manifests_ade147b") + assert.Equal(t, dep.Version, "ade147b") + assert.Equal(t, dep.Source.Git.Url, "https://github.com/kcl-lang/flask-demo-kcl-manifests.git") + assert.Equal(t, dep.Source.Git.Commit, "ade147b") + + // test dep from kcl.mod.lock + dep, _ = pkg.Dependencies.Deps.Get("flask-demo-kcl-manifests") + assert.Equal(t, dep.Name, "flask-demo-kcl-manifests") + assert.Equal(t, dep.FullName, "flask_manifests_0.0.1") + assert.Equal(t, dep.Version, "0.0.1") + assert.Equal(t, dep.Source.Git.Url, "https://github.com/kcl-lang/flask-demo-kcl-manifests.git") + assert.Equal(t, dep.Source.Git.Commit, "ade147b") +} diff --git a/pkg/loader/test_data/test_load_0/kcl.mod b/pkg/loader/test_data/test_load_0/kcl.mod new file mode 100644 index 00000000..7ba3c4c1 --- /dev/null +++ b/pkg/loader/test_data/test_load_0/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "test_load_0" +edition = "v0.10.0" +version = "0.0.1" +description = "A test package for the loader" +include = ["src/**/include.k"] +exclude = ["src/**/excluded.k"] diff --git a/pkg/loader/test_data/test_load_0/kcl.mod.lock b/pkg/loader/test_data/test_load_0/kcl.mod.lock new file mode 100644 index 00000000..e69de29b diff --git a/pkg/loader/test_data/test_load_0/main.k b/pkg/loader/test_data/test_load_0/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/pkg/loader/test_data/test_load_0/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/pkg/loader/test_data/test_load_1/kcl.mod b/pkg/loader/test_data/test_load_1/kcl.mod new file mode 100644 index 00000000..b1a3c64b --- /dev/null +++ b/pkg/loader/test_data/test_load_1/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "test_load_1" +edition = "v0.10.0" +version = "0.0.1" + +[dependencies] +helloworld = "0.1.2" diff --git a/pkg/loader/test_data/test_load_1/kcl.mod.lock b/pkg/loader/test_data/test_load_1/kcl.mod.lock new file mode 100644 index 00000000..e64da0b4 --- /dev/null +++ b/pkg/loader/test_data/test_load_1/kcl.mod.lock @@ -0,0 +1,5 @@ +[dependencies] + [dependencies.helloworld] + name = "helloworld" + full_name = "helloworld_0.1.2" + version = "0.1.2" diff --git a/pkg/loader/test_data/test_load_1/main.k b/pkg/loader/test_data/test_load_1/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/pkg/loader/test_data/test_load_1/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/pkg/loader/test_data/test_load_2/kcl.mod b/pkg/loader/test_data/test_load_2/kcl.mod new file mode 100644 index 00000000..e46990fa --- /dev/null +++ b/pkg/loader/test_data/test_load_2/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "test_load_2" +edition = "v0.10.0" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.1" } diff --git a/pkg/loader/test_data/test_load_2/kcl.mod.lock b/pkg/loader/test_data/test_load_2/kcl.mod.lock new file mode 100644 index 00000000..8f3c05db --- /dev/null +++ b/pkg/loader/test_data/test_load_2/kcl.mod.lock @@ -0,0 +1,8 @@ +[dependencies] + [dependencies.helloworld] + name = "helloworld" + full_name = "helloworld_0.1.1" + version = "0.1.1" + reg = "ghcr.io" + repo = "kcl-lang/helloworld" + oci_tag = "0.1.1" diff --git a/pkg/loader/test_data/test_load_2/main.k b/pkg/loader/test_data/test_load_2/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/pkg/loader/test_data/test_load_2/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/pkg/loader/test_data/test_load_3/kcl.mod b/pkg/loader/test_data/test_load_3/kcl.mod new file mode 100644 index 00000000..a0a107cc --- /dev/null +++ b/pkg/loader/test_data/test_load_3/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "test_load_3" +edition = "v0.10.0" +version = "0.0.1" + +[dependencies] +flask-demo-kcl-manifests = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git", commit = "ade147b" } diff --git a/pkg/loader/test_data/test_load_3/kcl.mod.lock b/pkg/loader/test_data/test_load_3/kcl.mod.lock new file mode 100644 index 00000000..935309f6 --- /dev/null +++ b/pkg/loader/test_data/test_load_3/kcl.mod.lock @@ -0,0 +1,7 @@ +[dependencies] + [dependencies.flask-demo-kcl-manifests] + name = "flask-demo-kcl-manifests" + full_name = "flask_manifests_0.0.1" + version = "0.0.1" + url = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git" + commit = "ade147b" diff --git a/pkg/loader/test_data/test_load_3/main.k b/pkg/loader/test_data/test_load_3/main.k new file mode 100644 index 00000000..fa7048e6 --- /dev/null +++ b/pkg/loader/test_data/test_load_3/main.k @@ -0,0 +1 @@ +The_first_kcl_program = 'Hello World!' \ No newline at end of file diff --git a/pkg/package/package.go b/pkg/package/package.go index a0a20aec..a2500999 100644 --- a/pkg/package/package.go +++ b/pkg/package/package.go @@ -58,6 +58,7 @@ func NewKclPkg(opts *opt.InitOptions) KclPkg { } } +// Deprecated: Use `KpmClient.LoadPkgFromPath()` instead. func LoadKclPkg(pkgPath string) (*KclPkg, error) { modFile, err := LoadModFile(pkgPath) if err != nil { @@ -109,6 +110,7 @@ func LoadKclPkg(pkgPath string) (*KclPkg, error) { HomePath: pkgPath, Dependencies: *deps, }, nil + } func FindFirstKclPkgFrom(path string) (*KclPkg, error) { diff --git a/test/e2e/test_suites/kpm/exec_inside_pkg/run_with_with_noargs_input/test_suite.stdout b/test/e2e/test_suites/kpm/exec_inside_pkg/run_with_with_noargs_input/test_suite.stdout index 934c6956..02eb773a 100644 --- a/test/e2e/test_suites/kpm/exec_inside_pkg/run_with_with_noargs_input/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_inside_pkg/run_with_with_noargs_input/test_suite.stdout @@ -4,7 +4,7 @@ NAME: kpm run - compile kcl package. USAGE: - kpm run command [command options] [arguments...] + kpm run command [command options] COMMANDS: help, h Shows a list of commands or help for one command diff --git a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_no_tag_arg/test_suite.stdout b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_no_tag_arg/test_suite.stdout index 29d868ec..a450a6c7 100644 --- a/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_no_tag_arg/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_outside_pkg/kpm_pull_with_no_tag_arg/test_suite.stdout @@ -4,7 +4,7 @@ NAME: kpm pull - pull kcl package from OCI registry. USAGE: - kpm pull command [command options] [arguments...] + kpm pull command [command options] COMMANDS: help, h Shows a list of commands or help for one command From 6300e6dc8b03f16bc4f20fe5fb4abb199cfab2da Mon Sep 17 00:00:00 2001 From: zongz Date: Thu, 19 Sep 2024 19:09:15 +0800 Subject: [PATCH 2/3] fix: fix CR comments Signed-off-by: zongz --- .github/workflows/e2e-test.yml | 6 --- .github/workflows/test-win.yaml | 6 --- .github/workflows/test.yaml | 6 --- pkg/client/client.go | 54 ++------------------- pkg/features/features.go | 5 +- pkg/loader/loader.go | 84 ++++++++++++++++----------------- pkg/loader/loader_test.go | 6 ++- 7 files changed, 51 insertions(+), 116 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index b268a25b..77d60fa9 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -29,9 +29,3 @@ jobs: - name: run e2e run: | make e2e - - - name: Running go tests with coverage and feature gate - env: - KPM_FEATURE_GATES: "SupportPackageLoader=true" - run: | - make e2e diff --git a/.github/workflows/test-win.yaml b/.github/workflows/test-win.yaml index 4e07966e..50b96c12 100644 --- a/.github/workflows/test-win.yaml +++ b/.github/workflows/test-win.yaml @@ -37,9 +37,3 @@ jobs: GO111MODULE: on run : | make cover - - name: Running go tests with coverage on Windows - env: - GO111MODULE: on - KPM_FEATURE_GATES: "SupportPackageLoader=true" - run : | - make cover diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 313313ad..274a0585 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -34,12 +34,6 @@ jobs: uses: shogo82148/actions-goveralls@v1 with: path-to-profile: coverage.out - - name: Running go tests with coverage and feature gate - env: - GO111MODULE: on - KPM_FEATURE_GATES: "SupportPackageLoader=true" - run: | - make cover - name: Send coverage uses: shogo82148/actions-goveralls@v1 with: diff --git a/pkg/client/client.go b/pkg/client/client.go index 51ed62c4..a96f95ce 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -42,8 +42,6 @@ import ( // KpmClient is the client of kpm. type KpmClient struct { - // The loader of the kcl package. - PkgLoader loader.Loader // The writer of the log. logWriter io.Writer // The downloader of the dependencies. @@ -79,7 +77,6 @@ func NewKpmClient() (*KpmClient, error) { logWriter: os.Stdout, settings: *settings, homePath: homePath, - PkgLoader: loader.NewFileLoader(settings), DepDownloader: &downloader.DepDownloader{}, }, nil } @@ -155,53 +152,10 @@ func (c *KpmClient) GetSettings() *settings.Settings { } func (c *KpmClient) LoadPkgFromPath(pkgPath string) (*pkg.KclPkg, error) { - if ok, err := features.Enabled(features.SupportPackageLoader); err != nil && ok { - return c.PkgLoader.Load(pkgPath) - } else { - modFile, err := c.LoadModFile(pkgPath) - if err != nil { - return nil, reporter.NewErrorEvent(reporter.FailedLoadKclMod, err, fmt.Sprintf("could not load 'kcl.mod' in '%s'", pkgPath)) - } - - // Get dependencies from kcl.mod.lock. - deps, err := c.LoadLockDeps(pkgPath) - - if err != nil { - return nil, reporter.NewErrorEvent(reporter.FailedLoadKclMod, err, fmt.Sprintf("could not load 'kcl.mod.lock' in '%s'", pkgPath)) - } - - // Align the dependencies between kcl.mod and kcl.mod.lock. - for _, name := range modFile.Dependencies.Deps.Keys() { - dep, ok := modFile.Dependencies.Deps.Get(name) - if !ok { - break - } - if dep.Local != nil { - if ldep, ok := deps.Deps.Get(name); ok { - var localFullPath string - if filepath.IsAbs(dep.Local.Path) { - localFullPath = dep.Local.Path - } else { - localFullPath, err = filepath.Abs(filepath.Join(pkgPath, dep.Local.Path)) - if err != nil { - return nil, reporter.NewErrorEvent(reporter.Bug, err, "internal bugs, please contact us to fix it.") - } - } - ldep.LocalFullPath = localFullPath - dep.LocalFullPath = localFullPath - ldep.Source = dep.Source - deps.Deps.Set(name, ldep) - modFile.Dependencies.Deps.Set(name, dep) - } - } - } - - return &pkg.KclPkg{ - ModFile: *modFile, - HomePath: pkgPath, - Dependencies: *deps, - }, nil - } + return loader.Load( + loader.WithPkgPath(pkgPath), + loader.WithSettings(&c.settings), + ) } func (c *KpmClient) LoadModFile(pkgPath string) (*pkg.ModFile, error) { diff --git a/pkg/features/features.go b/pkg/features/features.go index 842d5679..98e4dd94 100644 --- a/pkg/features/features.go +++ b/pkg/features/features.go @@ -10,13 +10,10 @@ import ( const ( // SupportMVS is the feature gate for enabling the support for MVS. SupportMVS = "SupportMVS" - // SupportPackageLoader is the feature gate for enabling the support for package loader. - SupportPackageLoader = "SupportPackageLoader" ) var features = map[string]bool{ - SupportMVS: false, - SupportPackageLoader: false, + SupportMVS: false, } func init() { diff --git a/pkg/loader/loader.go b/pkg/loader/loader.go index c4a63973..f863c914 100644 --- a/pkg/loader/loader.go +++ b/pkg/loader/loader.go @@ -11,39 +11,8 @@ import ( "kcl-lang.io/kpm/pkg/utils" ) -// Loader is an interface that defines the method to load a package. -type Loader interface { - Load(pkgPath string) (*pkg.KclPkg, error) -} - -// PkgLoader is a struct that contains the settings. -type PkgLoader struct { - settings *settings.Settings -} - -// NewPkgLoader creates a new PkgLoader. -func NewPkgLoader(settings *settings.Settings) *PkgLoader { - return &PkgLoader{ - settings: settings, - } -} - -// FileLoader is a struct that load a package from the file system. -type FileLoader struct { - PkgLoader -} - -// NewFileLoader creates a new FileLoader. -func NewFileLoader(settings *settings.Settings) *FileLoader { - return &FileLoader{ - PkgLoader: PkgLoader{ - settings: settings, - }, - } -} - // loadModFile loads the kcl.mod file from the package path. -func (fl *FileLoader) loadModFile(pkgPath string) (*pkg.ModFile, error) { +func loadModFile(pkgPath string) (*pkg.ModFile, error) { modFile := new(pkg.ModFile) err := modFile.LoadModFile(filepath.Join(pkgPath, pkg.MOD_FILE)) if err != nil { @@ -59,7 +28,7 @@ func (fl *FileLoader) loadModFile(pkgPath string) (*pkg.ModFile, error) { // preProcess pre-processes the package loaded from kcl.mod and kcl.mod.lock // 1. transform the local path to the absolute path. // 2. fill the default oci registry. -func (fl *FileLoader) preProcess(kpkg *pkg.KclPkg) error { +func preProcess(kpkg *pkg.KclPkg, settings *settings.Settings) error { for _, name := range kpkg.ModFile.Dependencies.Deps.Keys() { dep, ok := kpkg.ModFile.Dependencies.Deps.Get(name) if !ok { @@ -83,21 +52,21 @@ func (fl *FileLoader) preProcess(kpkg *pkg.KclPkg) error { // Fill the default oci registry. if dep.Source.Oci != nil { if len(dep.Source.Oci.Reg) == 0 { - dep.Source.Oci.Reg = fl.settings.DefaultOciRegistry() + dep.Source.Oci.Reg = settings.DefaultOciRegistry() } if len(dep.Source.Oci.Repo) == 0 { - urlpath := utils.JoinPath(fl.settings.DefaultOciRepo(), dep.Name) + urlpath := utils.JoinPath(settings.DefaultOciRepo(), dep.Name) dep.Source.Oci.Repo = urlpath } } if dep.Source.Registry != nil { if len(dep.Source.Registry.Reg) == 0 { - dep.Source.Registry.Reg = fl.settings.DefaultOciRegistry() + dep.Source.Registry.Reg = settings.DefaultOciRegistry() } if len(dep.Source.Registry.Repo) == 0 { - urlpath := utils.JoinPath(fl.settings.DefaultOciRepo(), dep.Name) + urlpath := utils.JoinPath(settings.DefaultOciRepo(), dep.Name) dep.Source.Registry.Repo = urlpath } @@ -108,8 +77,8 @@ func (fl *FileLoader) preProcess(kpkg *pkg.KclPkg) error { Name: dep.Name, Version: dep.Version, Oci: &downloader.Oci{ - Reg: fl.settings.DefaultOciRegistry(), - Repo: utils.JoinPath(fl.settings.DefaultOciRepo(), dep.Name), + Reg: settings.DefaultOciRegistry(), + Repo: utils.JoinPath(settings.DefaultOciRepo(), dep.Name), Tag: dep.Version, }, } @@ -124,9 +93,40 @@ func (fl *FileLoader) preProcess(kpkg *pkg.KclPkg) error { return nil } +type LoadOptions struct { + // The package path. + PkgPath string + // The settings with default oci registry. + Settings *settings.Settings +} + +type Option func(*LoadOptions) + +// WithPkgPath sets the package path. +func WithPkgPath(pkgPath string) Option { + return func(opts *LoadOptions) { + opts.PkgPath = pkgPath + } +} + +// WithSettings sets the settings with default oci registry. +func WithSettings(settings *settings.Settings) Option { + return func(opts *LoadOptions) { + opts.Settings = settings + } +} + // Load loads a package from the file system. -func (fl *FileLoader) Load(pkgPath string) (*pkg.KclPkg, error) { - modFile, err := fl.loadModFile(pkgPath) +func Load(options ...Option) (*pkg.KclPkg, error) { + + opts := &LoadOptions{} + for _, opt := range options { + opt(opts) + } + + pkgPath := opts.PkgPath + + modFile, err := loadModFile(pkgPath) if err != nil { return nil, fmt.Errorf("failed to load the package from the path %s: %w", pkgPath, err) } @@ -145,7 +145,7 @@ func (fl *FileLoader) Load(pkgPath string) (*pkg.KclPkg, error) { } // pre-process the package. - err = fl.preProcess(kpkg) + err = preProcess(kpkg, opts.Settings) if err != nil { return nil, fmt.Errorf("failed to load the package from the path %s: %w", pkgPath, err) } diff --git a/pkg/loader/loader_test.go b/pkg/loader/loader_test.go index bac87d21..915e0a66 100644 --- a/pkg/loader/loader_test.go +++ b/pkg/loader/loader_test.go @@ -21,8 +21,10 @@ func getTestDir(subDir string) string { } func load(t *testing.T, pkgPath string) *pkg.KclPkg { - loader := NewFileLoader(settings.GetSettings()) - pkg, err := loader.Load(pkgPath) + pkg, err := Load( + WithPkgPath(pkgPath), + WithSettings(settings.GetSettings()), + ) if err != nil { t.Fatal(err) } From d3cd9bbf550dcf82f529243cbfd1a36dd2ee883e Mon Sep 17 00:00:00 2001 From: zongz Date: Thu, 19 Sep 2024 19:16:17 +0800 Subject: [PATCH 3/3] fix: fix test case TestAddWithLocalPath Signed-off-by: zongz --- pkg/loader/loader.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/loader/loader.go b/pkg/loader/loader.go index f863c914..65026dd6 100644 --- a/pkg/loader/loader.go +++ b/pkg/loader/loader.go @@ -47,7 +47,6 @@ func preProcess(kpkg *pkg.KclPkg, settings *settings.Settings) error { } } dep.LocalFullPath = localFullPath - kpkg.ModFile.Dependencies.Deps.Set(name, dep) } // Fill the default oci registry. if dep.Source.Oci != nil { @@ -86,6 +85,7 @@ func preProcess(kpkg *pkg.KclPkg, settings *settings.Settings) error { kpkg.ModFile.Dependencies.Deps.Set(name, dep) if lockDep, ok := kpkg.Dependencies.Deps.Get(name); ok { lockDep.Source = dep.Source + lockDep.LocalFullPath = dep.LocalFullPath kpkg.Dependencies.Deps.Set(name, lockDep) } } @@ -118,7 +118,6 @@ func WithSettings(settings *settings.Settings) Option { // Load loads a package from the file system. func Load(options ...Option) (*pkg.KclPkg, error) { - opts := &LoadOptions{} for _, opt := range options { opt(opts)