Go test, report an error;
Error in go test panic: reflect: reflect. Value. Set using addressable value [recovered].
Solution: generally, there is an error of using unaddressable value, which indicates that the pointer value passed is incorrect. For example, if the pointer address needs to be passed, but the value is passed. At that time, I had a hunch that DB should have passed a non pointer when finding. After verification, it was.
So, the summary is: when updating in Gorm, you can not pass the pointer (if you want to use the returned primary key, you still need to pass the pointer), but when querying, you must pass it, even if it is slice or map type.
Read More:
- Code programming skills for novice programmers
- Linux novice: unable to locate package error solution
- Why use thread pools? Remember and understand
- Remember once to solve the problem that Ubuntu 18.04 can’t enter GUI
- Remember a virtual machine expansion swapoff failed: cannot allocate memory
- Remember a mybatis error org.apache.ibatis . session.defaults.DefaultSqlSession
- Remember a feign error: feign.FeignException : status 404 reading XXXClient#XXMethod(Long)
- appear pygame.error : font not initialized problem, remember to check whether the program calls pygame.init ()
- Remember that Maven can’t recognize Java_ Home problem error: Java_ HOME is not defined correctly.
- After the go pointer is declared and assigned, a panic: runtime error: invalid memory address or nil pointer reference appears
- panic: runtime error: index out of range
- An error occurs when pymysql uses% d to pass in parameters
- Error in dev C + + running pointer
- Common causes of Leetcode Runtime Error
- How to compare the equality of structures in golang
- Golang MySQL error SQL: unknown driver “MySQL” (Forgotten import?) solution
- Attributeerror: object has no attribute
- error: invalid use of non-static member function
- The solution of Hibernate query returning all null lists
- How to use C + + function pointer array