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:
- Multiple exceptions are caught in a single catch block
- Assignment under multiple single edges is not supported for synthesis
- The usage and difference of atoi() and stoi() functions in C + +
- error: ‘atoi’ was not declared in this scope
- Info:Memory module [DIMM] needs attention: Single-bit warning error rate exceeded, Single-bit fai…
- make Error: error: cast from ‘int32_t*’ {aka ‘int*’} to ‘int’ loses precision [-fpermissive]
- Go get github.com/kotakanbe/go -Problems encountered in CVE dictionary Download
- How do you set, clear and toggle a single bit in C?
- Flume monitors a single append file in real time
- Error in require.context in vue3 vite
- How to handle when select single is not allowed in loop
- Solution to the segmentation fault of single chain table in C language
- Three ways of single line and multi line comment in Python
- Go run error go run: cannot run non main package
- Mybatis passes in multiple parameters to mapper. And uses @param details to report an error
- ‘break’ not in the ‘loop’ or ‘switch’ context Error (Fixed)
- Error in go running: cannot find package “
- TypeError: int() can’t convert non-string with explicit base
- C++ —Return multiple values of different types
- Solution in idea java.lang.ClassNotFoundException : org.springframework.web . context.ContextLoaderListener