Note: These "pits" are not bugs, but they were not understood at the time.
The frame used is Beego
1, the dictionary map is "reference type", itself is a pointer, as a parameter to pass the map variable name directly (do not pass the map variable pointer).
Within the calling method, if the map variable value is modified, the value of the external map variable will be changed!
For example Beego Controller attribute data, if other places need to use this variable, directly into the data variable name, the reference code is as follows:
# # in-controller code
preprocessing func (c *passportcontroller) Prepare () { //Check User session state (whether logged in) res: = Passportservice.managercheckloginsession (C.ctx, C.data) println (res. MSG)}
# # method to call to
Func (S *passportservice) managercheckloginsession (Ctx *context. Context, Data map[interface{}]interface{}) *beego. Result { //... Code omitted}
2, go file can not be prefixed with "_", otherwise go to the bottom will ignore its existence (that is, the file does not work, the code will not work)
For example:_templatefunc.go This file is invalid
[Go] Developing a Go Web project, stepping on some "pits"