go :Multiple-value strconv.Atoi() (int, error) in single-value context

code

devicePositionType := strconv.Atoi(info[0]["device_position_type"].(string))

report errors

Multiple-value strconv.Atoi() (int, error) in single-value context

This is because the returned data has two parameters, and only one is defined in the code, so the code needs to add another parameter, which is generally defined as err

devicePositionType,err := strconv.Atoi(info[0]["device_position_type"].(string))

But I can’t use err. If I don’t use err, go will still report an error

Unused variable 'err'

So it needs to be written like this

devicePositionType,_ := strconv.Atoi(info[0]["device_position_type"].(string))

It means that I will not call it later, and I have defined two parameters and will not report an error

Read More: