@@ -544,19 +544,19 @@ go func(){
544
544
In Viper, there are a few ways to get a value depending on the value’s type.
545
545
The following functions and methods exist:
546
546
547
- * ` Get(key string) : interface{} `
547
+ * ` Get(key string) : any `
548
548
* ` GetBool(key string) : bool `
549
549
* ` GetFloat64(key string) : float64 `
550
550
* ` GetInt(key string) : int `
551
551
* ` GetIntSlice(key string) : []int `
552
552
* ` GetString(key string) : string `
553
- * ` GetStringMap(key string) : map[string]interface{} `
553
+ * ` GetStringMap(key string) : map[string]any `
554
554
* ` GetStringMapString(key string) : map[string]string `
555
555
* ` GetStringSlice(key string) : []string `
556
556
* ` GetTime(key string) : time.Time `
557
557
* ` GetDuration(key string) : time.Duration `
558
558
* ` IsSet(key string) : bool `
559
- * ` AllSettings() : map[string]interface{} `
559
+ * ` AllSettings() : map[string]any `
560
560
561
561
One important thing to recognize is that each Get function will return a zero
562
562
value if it’s not found. To check if a given key exists, the ` IsSet() ` method
719
719
720
720
There are two methods to do this :
721
721
722
- * `Unmarshal(rawVal interface{} ) : error`
723
- * `UnmarshalKey(key string, rawVal interface{} ) : error`
722
+ * `Unmarshal(rawVal any ) : error`
723
+ * `UnmarshalKey(key string, rawVal any ) : error`
724
724
725
725
Example :
726
726
@@ -745,9 +745,9 @@ you have to change the delimiter:
745
745
``` go
746
746
v := viper.NewWithOptions (viper.KeyDelimiter (" ::" ))
747
747
748
- v.SetDefault (" chart::values" , map [string ]interface {} {
749
- " ingress" : map [string ]interface {} {
750
- " annotations" : map [string ]interface {} {
748
+ v.SetDefault (" chart::values" , map [string ]any {
749
+ " ingress" : map [string ]any {
750
+ " annotations" : map [string ]any {
751
751
" traefik.frontend.rule.type" : " PathPrefix" ,
752
752
" traefik.ingress.kubernetes.io/ssl-redirect" : " true" ,
753
753
},
@@ -756,7 +756,7 @@ v.SetDefault("chart::values", map[string]interface{}{
756
756
757
757
type config struct {
758
758
Chart struct {
759
- Values map [string ]interface {}
759
+ Values map [string ]any
760
760
}
761
761
}
762
762
0 commit comments