Replace interface{} -> any (#370)

This commit is contained in:
Malte Poll 2022-10-25 15:51:23 +02:00 committed by GitHub
parent 7592143a69
commit 2d121d9243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 84 additions and 84 deletions

View file

@ -124,8 +124,8 @@ func TestUpdateImage(t *testing.T) {
"success": {
updater: &stubImageUpdater{
setImage: &unstructured.Unstructured{
Object: map[string]interface{}{
"spec": map[string]interface{}{
Object: map[string]any{
"spec": map[string]any{
"image": "old-image",
},
},
@ -137,8 +137,8 @@ func TestUpdateImage(t *testing.T) {
"image is the same": {
updater: &stubImageUpdater{
setImage: &unstructured.Unstructured{
Object: map[string]interface{}{
"spec": map[string]interface{}{
Object: map[string]any{
"spec": map[string]any{
"image": "old-image",
},
},
@ -153,8 +153,8 @@ func TestUpdateImage(t *testing.T) {
"update error": {
updater: &stubImageUpdater{
setImage: &unstructured.Unstructured{
Object: map[string]interface{}{
"spec": map[string]interface{}{
Object: map[string]any{
"spec": map[string]any{
"image": "old-image",
},
},
@ -167,7 +167,7 @@ func TestUpdateImage(t *testing.T) {
"no spec": {
updater: &stubImageUpdater{
setImage: &unstructured.Unstructured{
Object: map[string]interface{}{},
Object: map[string]any{},
},
},
newImage: "new-image",
@ -176,7 +176,7 @@ func TestUpdateImage(t *testing.T) {
"not a map": {
updater: &stubImageUpdater{
setImage: &unstructured.Unstructured{
Object: map[string]interface{}{
Object: map[string]any{
"spec": "not a map",
},
},
@ -187,8 +187,8 @@ func TestUpdateImage(t *testing.T) {
"no spec.image": {
updater: &stubImageUpdater{
setImage: &unstructured.Unstructured{
Object: map[string]interface{}{
"spec": map[string]interface{}{},
Object: map[string]any{
"spec": map[string]any{},
},
},
},
@ -215,7 +215,7 @@ func TestUpdateImage(t *testing.T) {
assert.NoError(err)
if tc.wantUpdate {
assert.Equal(tc.newImage, tc.updater.updatedImage.Object["spec"].(map[string]interface{})["image"])
assert.Equal(tc.newImage, tc.updater.updatedImage.Object["spec"].(map[string]any)["image"])
} else {
assert.Nil(tc.updater.updatedImage)
}

View file

@ -190,9 +190,9 @@ type warnLogger struct {
}
// Infof is a no-op since we don't want extra info messages when using the CLI.
func (wl warnLogger) Infof(format string, args ...interface{}) {}
func (wl warnLogger) Infof(format string, args ...any) {}
// Warnf prints a formatted warning from the validator.
func (wl warnLogger) Warnf(fmtStr string, args ...interface{}) {
func (wl warnLogger) Warnf(fmtStr string, args ...any) {
wl.cmd.PrintErrf("Warning: %s\n", fmt.Sprintf(fmtStr, args...))
}