go 错误总结

指针引用类型错误

1
cannot use user (type common.User) as type *common.User in argument to common.UserService.UpdateUser

解决办法

1
x := &common.User{}

基础没学好还是要多看书啊:(

参考 stackoverflow


项目中Makefile报错,看问题是制表符的问题,这个配置文件需要制表符而不是空格

1
Makefile:14: *** missing separator (did you mean TAB instead of 8 spaces?).  Stop.

解决办法

使用vi打开Makefile,把所有的空格替换成制表符 “\t”

1
:%s/^[ ]\+/\t/g

参考 https://unix.stackexchange.com