Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
jenting authored Dec 8, 2024
1 parent 6f18d3a commit d1abd69
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,26 @@ func main() {

case watch.Deleted:
fmt.Println("Application deleted:", event.Object)

fmt.Printf("Kind: %s, Name: %s/%s\n", obj.GetKind(), obj.GetName(), obj.GetNamespace())

// Print spec.project
specProject, _, err := unstructured.NestedString(obj.Object, "spec", "project")
if err != nil {
fmt.Printf("Error getting spec.project: %v\n", err)
return
}
fmt.Printf("spec.project: %s\n", specProject)

// Set and Get a key-value pair
key := fmt.Sprintf("%s|%s", specProject, obj.GetName())
val, _ := json.Marshal(event.Object)

Check failure on line 150 in main.go

View workflow job for this annotation

GitHub Actions / build (1.22)

declared and not used: val

err = rdb.Del(key).Err()
if err != nil {
log.Fatalf("Failed to set key: %v", err)
}

case watch.Bookmark, watch.Error:
default:
}
Expand Down

0 comments on commit d1abd69

Please sign in to comment.