GO
来杯Sherry
这个作者很懒,什么都没留下…
展开
-
cannot use r.db (type *“gorm.io/gorm“.DB) as type *“github.com/jinzhu/gorm“.DB【Go、Gin】
我的原因是:项目目录重构时,自动导入的是这个包"gorm.io/gorm"正确的包:"github.com/jinzhu/gorm"原创 2021-06-09 21:55:54 · 926 阅读 · 0 评论 -
Error loading workspace: You are outside of a module and outside of $GOPATH/src. If you are using mo
1、描述:如果你使用vsCode去编译 go 项目的时候,出现这个错误,那么并不是你的go moudle 除了问题,同时你会发现执行Run Code也是执行失败的2、原因:你的工作区默认是项目根目录,但你单开的文件并不是项目根目录3、解决:重新打开文件,定位到项目的根目录,比如这里的src/github/.../prj1 ,我只要重新打开文件夹为prj1就可以了,并且此时也可以执行右键Run Code了...原创 2021-06-04 15:52:03 · 10577 阅读 · 8 评论 -
vsCode设置Run in Terminal【go】
go服务关闭,需要手动关闭,这个时候在Terminal下就很方便,vsCode默认输出在outPut区域,对交互操作就很不友好步骤:来到文件/首选项/,搜索run in terminal,勾选即可原创 2021-06-04 15:43:18 · 5334 阅读 · 5 评论 -
GO的几个输出【GoLang】
刚开始接触,GO的输出还挺多在最常用的两个方面做了比较1、纯文本输出 fmt.Println("hello world!") fmt.Print("hello world!!\n") fmt.Printf("hello world!!!\n")//reshello world!hello world!!hello world!!!2、携带变量输出 var a int = 1 var b = 2 var c = 3 fmt.Println("hello world!", a,b,原创 2021-05-25 14:37:25 · 757 阅读 · 0 评论