什么是毒蛇的正确类型

I have the following yaml file and want to iterate over the cameraids.---

--- 
profiles:
  HDready: ' -vcodec libx264 -pix_fmt yuv420p -crf 23 -s 1280x720 '
  mobile: ' -vcodec libx264 -pix_fmt yuv420p -crf 23 -s 480x270 '

cameraids:
  111:
    fps: 30
  191:
    fps: 50
  851:
    fps: 50

I want now to iterate over the cameraids and profiles therefore I declare the variable for cameraids like this

var camids map[string]interface{}

The same as the fmt.Println(reflect.TypeOf(viper.Get("cameraids"))) prints but I always get the following error no new variables on left side of := when I try to get the map from viper

camids := viper.GetStringMap("cameraids")

Please can you explain and help me what I misunderstand, thanks.

If you've declared camids

var camids map[string]interface{}

above, you don't need to use := since the variable camids has been already declared.
So just write:

camids = viper.GetStringMap("cameraids")



:= is used when you want to declare the variable and assigns the value to it at the same time.

= is used when you've already declared the variable beforehand and you're just assigning the value to it.