Go Error: Cannot Use 'v' (UserRelationship) as Pointer *UserRelationship
The error message you are receiving indicates that you are trying to use a variable of type 'UserRelationship' as a pointer to 'UserRelationship'.
To resolve this error, you need to use the '&' operator to take the address of the 'UserRelationship' variable and assign it to a pointer of type '*UserRelationship'. Here's an example:
var v UserRelationship
p := &v
In this example, 'v' is of type 'UserRelationship', and 'p' is a pointer to 'UserRelationship' ('*UserRelationship'). By using the '&' operator before 'v', you are getting the address of 'v', which can be assigned to 'p'.
Make sure to adjust your code accordingly to fix the error.
原文地址: https://www.cveoy.top/t/topic/qAkl 著作权归作者所有。请勿转载和采集!