文章分类 -  Golang

摘要:go fmt : 统一的代码格式化工具安装: go install github.com/fsgo/go_fmt@latest golangci-lint : 静态代码质量检测工具,用于包的质量分析安装: go install github.com/golangci/golangci-lint/cm 阅读全文
posted @ 2022-04-10 10:40 Awakenedy 阅读(265) 评论(0) 推荐(0) 编辑
摘要:golang 中的signal 包的Notify函数 转:https://www.cnblogs.com/landv/p/13139127.html 函数声明为 func Notify(c chan<- os.Signal, sig ...os.Signal) 官方描述: Notify函数让sign 阅读全文
posted @ 2022-04-08 20:26 Awakenedy 阅读(602) 评论(0) 推荐(0) 编辑
摘要:转:https://github.com/daviddengcn/gosl gosl This is an application that can make you write script with the Go language. It is NOT an interpreter but th 阅读全文
posted @ 2022-04-08 19:49 Awakenedy 阅读(40) 评论(0) 推荐(0) 编辑
摘要:golang文件读写 func OpenFile(name string, flag int, perm FileMode) (*File, error) 第一个参数为文件路径,第二个参数控制文件的打开方式,第三个参数控制文件模式 打开方式 const ( // Exactly one of O_R 阅读全文
posted @ 2021-12-14 19:23 Awakenedy 阅读(1709) 评论(0) 推荐(0) 编辑
摘要:转置https://www.cnblogs.com/xiao-xue-di/p/11521823.html Go语言fmt.Printf使用指南 fmt标准库是我们在学习Go语言过程中接触最早最频繁的一个了,本文介绍了fmtb包的一些常用函数。 fmt fmt包实现了类似C语言printf和scan 阅读全文
posted @ 2021-11-10 21:28 Awakenedy 阅读(104) 评论(0) 推荐(0) 编辑
摘要:转置:https://blog.csdn.net/benben_2015/article/details/82227338 Go1.1.1版本发布(2018-08-24发布)已经过去几天,从官方的博客中看到,有两个比较突出的特色,一个就是今天讲的module,模块概念。目前该功能还在试验阶段,有些地 阅读全文
posted @ 2021-05-11 12:45 Awakenedy 阅读(70) 评论(0) 推荐(0) 编辑
摘要:安装redis客户端 go get -u github.com/go-redis/redis 常见的全局命令 全局命令是对任意类型的键都有效果的 代码中展示的只是部分命令的使用 package main import ( "fmt" "github.com/go-redis/redis" "time 阅读全文
posted @ 2020-06-23 09:20 Awakenedy 阅读(616) 评论(0) 推荐(0) 编辑
摘要:1 package main 2 3 import ( 4 "fmt" 5 "strconv" 6 "strings" 7 ) 8 9 func main() { 10 sText := "中文" 11 textQuoted := strconv.QuoteToASCII(sText) 12 tex 阅读全文
posted @ 2020-06-15 09:12 Awakenedy 阅读(1364) 评论(0) 推荐(0) 编辑
摘要:报错信息:./main.go:22:14: app.APIBuilder.Macros().Int undefined (type *macro.Macros has no field or method Int) 第一种修改: app.Macros().Get("int").RegisterFun 阅读全文
posted @ 2020-06-05 08:34 Awakenedy 阅读(328) 评论(0) 推荐(0) 编辑
摘要:gdb原生支持golang的调试,但是像info goroutines此类有go特性的命令却无法使用, info goroutines,提示找不到Undefined info command: "goroutines". Try "help info". 以下列出解决方案。 首先找到go的安装路径 阅读全文
posted @ 2020-05-29 08:41 Awakenedy 阅读(429) 评论(0) 推荐(0) 编辑
摘要:GO111MODULEGO111MODULE 有三个值:off, on和auto(默认值)。 GO111MODULE=off,go命令行将不会支持module功能,寻找依赖包的方式将会沿用旧版本那种通过vendor目录或者GOPATH模式来查找。 GO111MODULE=on,go命令行会使用mod 阅读全文
posted @ 2020-05-01 16:43 Awakenedy 阅读(20952) 评论(1) 推荐(0) 编辑
摘要:vim-go 是一款go代码高亮和语法检查的插件 安装方法,clone vim-go 到 ~/.vim/bundle 目录下即可 # cd ~/.vim/bundle/ # git clone https://github.com/fatih/vim-go.git # ls vim-go vim-m 阅读全文
posted @ 2020-04-21 11:43 Awakenedy 阅读(3973) 评论(0) 推荐(0) 编辑
摘要:转置:https://blog.csdn.net/weixin_41918841/article/details/82898173 golang sort package: https://golang.org/src/sort sort 操作的对象通常是一个 slice,需要满足三个基本的接口,并 阅读全文
posted @ 2020-04-17 15:16 Awakenedy 阅读(269) 评论(0) 推荐(0) 编辑