Golang

a wooden desk topped with a laptop computer next to a monitor

解决Mac 上更新或重装golang后,执行go run 出现fork/exec /var/folders/ty/xxx/b001/exe/main: exec format error错误

最近升级了mac的Golang版本,当我在terminal执行go run main.go命令时,出现如下错误:fork/exec /var/folders/ty/q11880gn5797hjv_tnk2m_k80000gn/T/go-build3935763930/b001/exe/m

a woman using a laptop computer on a bed

Golang GORM query locations around a position with Lat and Lng

https://stackoverflow.com/questions/53630860/golang-gorm-query-locations-arou

no image

Golang Gin微信支付V3 SDK 统一下单使用

mysql当查询条件为空时不作为条件查询(Gorm)

// Show 查询func (p *CategoryModel) Show(parent interface{}) (counts int64, temp []CategoryModel) { if parent == 0 { parent = sql2.NullInt32{} } sql

no image

panic: assignment to entry in nil map

golang中map是引用类型,应用类型的变量未初始化时默认的zero value是nil。直接向nil map写入键值数据会导致运行时错误panic: assignment to entry in nil map因为在声明alphabetMap后并未初始化它,所以它的值是nil, 不指向任何内存地址。需要通过make方法分配确定的内存地址。程序修改后即可正常

no image

golang json 编码解码

golang "encoding/json"包实现了json对象的编解码https://www.cnblogs.com/fhb2011/p/8975184.html一、编码func Marshal(v interface{})

学Golang,这里开始,Go资源汇总

1、Go学习笔记:雨痕大神一直保持着更新,推荐阅读!2、Go夜读:推进大家深入了解Go ,快速成长为资深的Gopher3、

brown pot with green plant on wooden bench

给函数起个好名字—函数中的动词选取

原文地址:https://www.bilibili.com/video/BV193411p7JK?share_source=copy_web选取原则1 避免滥用通用单词案例1:万能的Get

Go语言学习笔记:使用Air热加载Gin框架

https://github.com/cosmtrek/air