-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db8373b
commit bf217cf
Showing
3 changed files
with
8 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,11 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"k8s.io/klog/v2" | ||
) | ||
|
||
func assertf(condition bool, format string, args ...any) { | ||
if !condition { | ||
panic(fmt.Errorf(format, args...)) | ||
klog.Fatalf(format, args...) | ||
} | ||
} | ||
|
||
// prettyPrint is just a useful debugging function | ||
func prettyPrint(obj any) { | ||
// For pretty-printed JSON, use json.MarshalIndent | ||
prettyJSON, err := json.MarshalIndent(obj, "", " ") | ||
if err != nil { | ||
fmt.Println("Error marshalling to pretty JSON:", err, ". obj: ", obj) | ||
return | ||
} | ||
|
||
// Print the pretty JSON string | ||
fmt.Println(string(prettyJSON)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters