单值上下文中的多值f.strength [重复]

This question already has an answer here:

I have the function Strength():

func (g Group) Strength() (Name []Entity, err error)

I am trying to call this function and store the values in some variable like below:

for _,x := range f.Strength() {
        ...
    }

But this is giving error:

multiple-value f.strength in single-value context

</div>

Strength() returns a slice and error. Try this.

strengths,err := f.Strength()
if err != nil{
   // Handler err
}

for _,x := range strengths{
  ...
}