chore: replace interface with any
This commit is contained in:
committed by
Ralf Haferkamp
parent
8f26149743
commit
288e67cc39
@@ -51,7 +51,7 @@ type Application struct {
|
||||
Entrypoint string `json:"entrypoint" validate:"required"`
|
||||
|
||||
// Config contains the application-specific configuration
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
Config map[string]any `json:"config,omitempty"`
|
||||
}
|
||||
|
||||
// ToExternal converts an Application to an ExternalApp configuration
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestApplication_ToExternal(t *testing.T) {
|
||||
app := apps.Application{
|
||||
ID: "app",
|
||||
Entrypoint: "entrypoint.js",
|
||||
Config: map[string]interface{}{
|
||||
Config: map[string]any{
|
||||
"foo": "bar",
|
||||
},
|
||||
}
|
||||
@@ -114,7 +114,7 @@ func TestBuild(t *testing.T) {
|
||||
g.Expect(err).ToNot(gomega.HaveOccurred())
|
||||
|
||||
g.Expect(application.Entrypoint).To(gomega.Equal("app/entrypoint.js"))
|
||||
g.Expect(application.Config).To(gomega.Equal(map[string]interface{}{
|
||||
g.Expect(application.Config).To(gomega.Equal(map[string]any{
|
||||
"k1": "1", "k2": "overwritten-from-config.json", "k3": "overwritten-from-apps.yaml", "injected_from_config_json": "11", "injected_from_apps_yaml": "22",
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ type ExternalApp struct {
|
||||
ID string `json:"id,omitempty" yaml:"id"`
|
||||
Path string `json:"path,omitempty" yaml:"path"`
|
||||
// Config is completely dynamic, because it depends on the extension
|
||||
Config map[string]interface{} `json:"config,omitempty" yaml:"config"`
|
||||
Config map[string]any `json:"config,omitempty" yaml:"config"`
|
||||
}
|
||||
|
||||
// ExternalAppConfig defines an external web app configuration.
|
||||
|
||||
@@ -27,7 +27,7 @@ func MergeKV(values ...KV) (KV, error) {
|
||||
}
|
||||
|
||||
// PatchKV injects the given values into to v.
|
||||
func PatchKV(v map[string]interface{}, values KV) KV {
|
||||
func PatchKV(v map[string]any, values KV) KV {
|
||||
if v == nil {
|
||||
v = KV{}
|
||||
}
|
||||
@@ -47,10 +47,10 @@ func PatchKV(v map[string]interface{}, values KV) KV {
|
||||
}
|
||||
|
||||
if _, ok := t[p]; !ok {
|
||||
t[p] = map[string]interface{}{}
|
||||
t[p] = map[string]any{}
|
||||
}
|
||||
|
||||
t = t[p].(map[string]interface{})
|
||||
t = t[p].(map[string]any)
|
||||
}
|
||||
}
|
||||
return v
|
||||
|
||||
@@ -32,10 +32,10 @@ func TestMergeKV(t *testing.T) {
|
||||
|
||||
func TestPatchKV(t *testing.T) {
|
||||
in := theme.KV{
|
||||
"a": map[string]interface{}{
|
||||
"a": map[string]any{
|
||||
"value": "a",
|
||||
},
|
||||
"b": map[string]interface{}{
|
||||
"b": map[string]any{
|
||||
"value": "b",
|
||||
},
|
||||
}
|
||||
@@ -46,18 +46,18 @@ func TestPatchKV(t *testing.T) {
|
||||
"e.value.subvalue": "e-new",
|
||||
})
|
||||
assert.Equal(t, theme.KV{
|
||||
"a": map[string]interface{}{
|
||||
"a": map[string]any{
|
||||
"value": "a",
|
||||
},
|
||||
"b": map[string]interface{}{
|
||||
"b": map[string]any{
|
||||
"value": "b-new",
|
||||
},
|
||||
"c": map[string]interface{}{
|
||||
"c": map[string]any{
|
||||
"value": "c-new",
|
||||
},
|
||||
"d": "d-new",
|
||||
"e": map[string]interface{}{
|
||||
"value": map[string]interface{}{
|
||||
"e": map[string]any{
|
||||
"value": map[string]any{
|
||||
"subvalue": "e-new",
|
||||
},
|
||||
},
|
||||
@@ -66,10 +66,10 @@ func TestPatchKV(t *testing.T) {
|
||||
|
||||
func TestPatchKVUnset(t *testing.T) {
|
||||
in := theme.KV{
|
||||
"a": map[string]interface{}{
|
||||
"a": map[string]any{
|
||||
"value": "a",
|
||||
},
|
||||
"b": map[string]interface{}{
|
||||
"b": map[string]any{
|
||||
"value": "b",
|
||||
},
|
||||
}
|
||||
@@ -78,7 +78,7 @@ func TestPatchKVUnset(t *testing.T) {
|
||||
"b": nil,
|
||||
})
|
||||
assert.Equal(t, theme.KV{
|
||||
"a": map[string]interface{}{},
|
||||
"a": map[string]any{},
|
||||
}, out)
|
||||
}
|
||||
|
||||
@@ -91,15 +91,15 @@ func TestPatchKVwithNil(t *testing.T) {
|
||||
"e.value.subvalue": "e-new",
|
||||
})
|
||||
assert.Equal(t, theme.KV{
|
||||
"b": map[string]interface{}{
|
||||
"b": map[string]any{
|
||||
"value": "b-new",
|
||||
},
|
||||
"c": map[string]interface{}{
|
||||
"c": map[string]any{
|
||||
"value": "c-new",
|
||||
},
|
||||
"d": "d-new",
|
||||
"e": map[string]interface{}{
|
||||
"value": map[string]interface{}{
|
||||
"e": map[string]any{
|
||||
"value": map[string]any{
|
||||
"subvalue": "e-new",
|
||||
},
|
||||
},
|
||||
@@ -108,10 +108,10 @@ func TestPatchKVwithNil(t *testing.T) {
|
||||
|
||||
func TestLoadKV(t *testing.T) {
|
||||
in := theme.KV{
|
||||
"a": map[string]interface{}{
|
||||
"a": map[string]any{
|
||||
"value": "a",
|
||||
},
|
||||
"b": map[string]interface{}{
|
||||
"b": map[string]any{
|
||||
"value": "b",
|
||||
},
|
||||
}
|
||||
@@ -128,10 +128,10 @@ func TestLoadKV(t *testing.T) {
|
||||
|
||||
func TestWriteKV(t *testing.T) {
|
||||
in := theme.KV{
|
||||
"a": map[string]interface{}{
|
||||
"a": map[string]any{
|
||||
"value": "a",
|
||||
},
|
||||
"b": map[string]interface{}{
|
||||
"b": map[string]any{
|
||||
"value": "b",
|
||||
},
|
||||
}
|
||||
@@ -149,10 +149,10 @@ func TestWriteKV(t *testing.T) {
|
||||
|
||||
func TestUpdateKV(t *testing.T) {
|
||||
fileKV := theme.KV{
|
||||
"a": map[string]interface{}{
|
||||
"a": map[string]any{
|
||||
"value": "a",
|
||||
},
|
||||
"b": map[string]interface{}{
|
||||
"b": map[string]any{
|
||||
"value": "b",
|
||||
},
|
||||
}
|
||||
@@ -173,13 +173,13 @@ func TestUpdateKV(t *testing.T) {
|
||||
var out theme.KV
|
||||
assert.Nil(t, json.NewDecoder(f).Decode(&out))
|
||||
assert.Equal(t, out, theme.KV{
|
||||
"a": map[string]interface{}{
|
||||
"a": map[string]any{
|
||||
"value": "a",
|
||||
},
|
||||
"b": map[string]interface{}{
|
||||
"b": map[string]any{
|
||||
"value": "b-new",
|
||||
},
|
||||
"c": map[string]interface{}{
|
||||
"c": map[string]any{
|
||||
"value": "c-new",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestService_Get(t *testing.T) {
|
||||
primaryFS := fsx.NewMemMapFs()
|
||||
fallbackFS := fsx.NewFallbackFS(primaryFS, fsx.NewMemMapFs())
|
||||
|
||||
add := func(filename string, content interface{}) {
|
||||
add := func(filename string, content any) {
|
||||
b, err := json.Marshal(content)
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -45,11 +45,11 @@ func TestService_Get(t *testing.T) {
|
||||
}
|
||||
|
||||
// baseTheme
|
||||
add("base/theme.json", map[string]interface{}{
|
||||
add("base/theme.json", map[string]any{
|
||||
"base": "base",
|
||||
})
|
||||
// brandingTheme
|
||||
add("_branding/theme.json", map[string]interface{}{
|
||||
add("_branding/theme.json", map[string]any{
|
||||
"_branding": "_branding",
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user