From df5ffc9847c870a55d0584e2383dc42736767a59 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 11 Nov 2024 15:50:27 +0000 Subject: [PATCH 1/2] Fix two warnings in repository.go --- .vscode/launch.json | 5 +++-- pkg/cache/memory/repository.go | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a72ff53f..a121a34e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,14 +14,15 @@ "--secure-port=4443", "--kubeconfig=${env:KUBECONFIG}", "--cache-directory=${workspaceFolder}/.cache", - "--function-runner=${env:FUNCTION_RUNNER_IP}:9445", + "--function-runner=localhost:30001", "--repo-sync-frequency=60s" ], "cwd": "${workspaceFolder}", "env": { "CERT_STORAGE_DIR": "${workspaceFolder}/.build/pki/tmp", "WEBHOOK_HOST": "localhost", - "GOOGLE_API_GO_EXPERIMENTAL_DISABLE_NEW_AUTH_LIB": "true" + "GOOGLE_API_GO_EXPERIMENTAL_DISABLE_NEW_AUTH_LIB": "true", + "OTEL": "otel://localhost:4317" } }, { diff --git a/pkg/cache/memory/repository.go b/pkg/cache/memory/repository.go index 432daeb4..b3874e0d 100644 --- a/pkg/cache/memory/repository.go +++ b/pkg/cache/memory/repository.go @@ -28,7 +28,6 @@ import ( "github.com/nephio-project/porch/pkg/repository" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/trace" - "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/watch" @@ -214,9 +213,7 @@ func (r *cachedRepository) update(ctx context.Context, updated repository.Packag Package: k.Package, WorkspaceName: k.WorkspaceName, } - if _, ok := r.cachedPackageRevisions[oldKey]; ok { - delete(r.cachedPackageRevisions, oldKey) - } + delete(r.cachedPackageRevisions, oldKey) } cached := &cachedPackageRevision{PackageRevision: updated} @@ -264,7 +261,7 @@ func (r *cachedRepository) createMainPackageRevision(ctx context.Context, update // Create the package if it doesn't exist _, err := r.metadataStore.Get(ctx, pkgRevMetaNN) - if errors.IsNotFound(err) { + if apierrors.IsNotFound(err) { pkgRevMeta := meta.PackageRevisionMeta{ Name: updatedMain.KubeObjectName(), Namespace: updatedMain.KubeObjectNamespace(), From 42556c1adb08c192b8354fe205f02bfe5635d14c Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 11 Nov 2024 15:52:48 +0000 Subject: [PATCH 2/2] Restore .vscode/launch.json --- .vscode/launch.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a121a34e..a72ff53f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,15 +14,14 @@ "--secure-port=4443", "--kubeconfig=${env:KUBECONFIG}", "--cache-directory=${workspaceFolder}/.cache", - "--function-runner=localhost:30001", + "--function-runner=${env:FUNCTION_RUNNER_IP}:9445", "--repo-sync-frequency=60s" ], "cwd": "${workspaceFolder}", "env": { "CERT_STORAGE_DIR": "${workspaceFolder}/.build/pki/tmp", "WEBHOOK_HOST": "localhost", - "GOOGLE_API_GO_EXPERIMENTAL_DISABLE_NEW_AUTH_LIB": "true", - "OTEL": "otel://localhost:4317" + "GOOGLE_API_GO_EXPERIMENTAL_DISABLE_NEW_AUTH_LIB": "true" } }, {