![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Go初学
文章平均质量分 92
四火流年
这个作者很懒,什么都没留下…
展开
-
2018-09-13 beego中Query和Param的区别
源码 input里的Param和Query // Param returns router param by a given key. func (input *BeegoInput) Param(key string) string { for i, v := range input.pnames { if v == key && i <= len(input.pvalues) { return input.pvalues[i]原创 2020-09-06 17:41:00 · 739 阅读 · 0 评论 -
2018-05-21 Go下载第三方包
使用 go get 下载和安装系统包、第三方包的时候,如果包地址是:golang.org/x/… 时,往往下载不下来。 但是这些包的代码也都是托管在github上的,所以可以通过手动下载安装的方法来进行下载。 例如: cd $GOPATH/src/golang.org/x git clone https://github.com/golang/net.git 参考文档: https://www.golangtc.com/download/package ...原创 2020-08-25 17:59:50 · 75 阅读 · 0 评论 -
Go best practices
Successful Go Program Design, 6 Years On Development environment Some Go developers uses a two-entry GOPATH, e.g. HOME/go/external:HOME/go/external:HOME/go/external:HOME/go/internal go get will...转载 2018-05-18 22:44:22 · 243 阅读 · 0 评论 -
2018-05-05 Go语言中 make 和 new 的区别
背景介绍 make new make vs. new 代码样例 zero value of the type(零值) declare、allocate、initialize、赋值 用new去给 slice、map、chan进行内存分配 总结 参考文档 背景介绍 学习Go的时候,遇到了 make 和 new 的区别问题。网上查看了很多文档,大体都是4个区别(见下文),但...原创 2018-05-18 23:58:38 · 151 阅读 · 0 评论 -
2018-03-13 Twelve Go Best Practices
Best practices Code sample 1. 先处理错误,来避免嵌套(avoid nesting by handling errors first) 2. 避免重复(avoid repetition when possible) 处理特殊类型的数据(Type switch to handle special cases) 再进一步优化,变量名变短(Type switch wi...转载 2018-05-20 09:56:19 · 233 阅读 · 0 评论 -
Go基本概念
编码 声明变量 常量 变量类型 iota enumerate 潜规则 数组,切片,映射 数组 切片 映射 make, new 控制语句 if goto for switch function pass by pointers defer main and init functions import struct 编码 Go默认支持UTF-8编码 声明...原创 2018-05-19 00:09:02 · 143 阅读 · 0 评论 -
2018-02-07 Go如何记录日志
一、背景介绍 二、如何使用 三、引擎配置 console file multifile conn smtp Elasticsearch 简聊 slack 四、异步输出日志 五、级别 六、样例 logOutputs Async format 参考文档 一、背景介绍 首先,Go没有Exception(Why does Go not have exceptions)...原创 2018-05-19 00:18:00 · 1009 阅读 · 0 评论