![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Golang编程记录
记录一些Golang相关的技巧 及 基础使用
听我一言
这个作者很懒,什么都没留下…
展开
-
Android USB调试模式下自动上下滑动(Go实现)
Golang实现通过ADB控制手机自动上下滑动原创 2024-05-28 16:46:32 · 634 阅读 · 0 评论 -
Go实现网页 临时电脑目录访问
Go实现临时网页访问电脑目录, 可实现IP过滤原创 2024-05-04 00:00:00 · 154 阅读 · 0 评论 -
Go实现 - 树莓派自己烧录自己 之 多读卡器同时烧录
Go实现 监控读卡器设备存储空间变化, 自动烧写SD Card, 烧写完成之后自动弹出, 显示执行状态, 还支持热插拔。原创 2024-05-03 00:00:00 · 215 阅读 · 0 评论 -
Go实现监控SD Card读卡器大小空间大小变化
监控SD Card读卡器的存储空间大小变化, 相当于监控是否有SD Card接入。原创 2024-05-03 00:00:00 · 215 阅读 · 0 评论 -
GO解析 - Linux 指令之 lsblk
Go实现解析 lsblk指令原创 2024-05-01 02:30:17 · 561 阅读 · 0 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(9)辅助模块-arp+ping识别网络设备
Golang实现一个批量自动化执行树莓派指令的软件(9)辅助模块-arp+ping识别网络设备原创 2024-04-30 01:45:00 · 285 阅读 · 0 评论 -
Golang中实现调用Windows API向指定目标发送ARP请求
Golang中实现调用Windows API向指定目标发送ARP请求原创 2024-04-29 11:00:20 · 1300 阅读 · 0 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(9)辅助模块-调用Ping指令判定在线
Golang实现一个批量自动化执行树莓派指令的软件(8)辅助模块-调用Ping指令判定在线原创 2024-04-28 11:15:14 · 662 阅读 · 0 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(8)辅助模块-远程IP端口是否开放连接(TCP)
Golang实现 - 判定远程IP端口是否开放连接(TCP)原创 2024-04-27 20:35:59 · 539 阅读 · 0 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(7)辅助模块-本地活动网络
Golang实现一个批量自动化执行树莓派指令的软件(7)辅助模块-获取本地活动网络原创 2024-04-27 17:16:34 · 540 阅读 · 0 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(6)简易批量指令处理
Golang实现一个批量自动化执行树莓派指令的软件(6)简单批量指令处理原创 2024-04-26 00:05:17 · 355 阅读 · 3 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(5)模块整合
Golang实现一个批量自动化执行树莓派指令的软件(5)模块整合原创 2024-04-26 00:04:20 · 238 阅读 · 1 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(4)上传
Golang实现一个批量自动化执行树莓派指令的软件(4)上传原创 2024-04-25 12:24:48 · 267 阅读 · 0 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(3)下载
Golang实现通过ssh自动批量树莓派指令执行(3)下载原创 2024-04-25 12:18:39 · 412 阅读 · 0 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(2)指令
基于Golang,实现ssh自动批量化指令执行(2)实现指令模块原创 2024-04-25 11:21:16 · 546 阅读 · 1 评论 -
Golang实现一个批量自动化执行树莓派指令的软件(1)文本加密&配置&命令行交互实现
基于Golang, 实现ssh批量化操作树莓派(1)-文本加密&配置&命令行交互实现原创 2024-04-25 11:12:19 · 312 阅读 · 0 评论 -
Golang+Qt合作 : go-echarts + QWebEngineView
无聊使用了一下go-echarts, 使用Qt在C/S模式下嵌入使用B/S框架的简单例子原创 2024-01-12 00:00:00 · 792 阅读 · 0 评论 -
Go : ssh操作(五)功能集合
将指令,上传,下载,批处理,多有功能集中起来原创 2024-01-11 00:00:00 · 421 阅读 · 0 评论 -
Go : ssh操作(四)批处理
有的时候我们不只是进行单纯的上传, 下载, 指令, 而是多个动作的组合操作原创 2024-01-11 00:00:00 · 504 阅读 · 0 评论 -
Go : ssh操作(三)上传
上传本地文件到远程主机原创 2024-01-10 00:00:00 · 445 阅读 · 0 评论 -
Go : ssh操作(二)下载
从远程主机下载文件到本地, 支持回调函数原创 2024-01-10 00:00:00 · 411 阅读 · 0 评论 -
Go : ssh 操作(一) 指令
基于 ssh 执行远程主机指令, 返回远程主机输出原创 2024-01-09 01:30:00 · 426 阅读 · 0 评论 -
golang:gorm SQL导出
1. gorm主页https://gorm.io/zh_CN/docs/2. 代码import ( "gorm.io/gorm" "gorm.io/driver/sqlite")/* 存储结构 - 表结构 */type Product struct { gorm.Model Code string Price uint}type RecorderLogger struct { logger.Interface //Statements []string原创 2021-05-21 08:15:51 · 1680 阅读 · 0 评论 -
Golang实用工具包 : 避免重复造轮子
goutilgithub.com/ThreeKing2018/goutil功能 包名 备注 目录操作 pwdtools 获取目录 数值转换 convertor 操作数字等 时间操作 time 获取自定义时间格式等 数组操作 array 数组转换等 文件操作 filetool 获取文件目录,读取,写等 格式化操作 formatter 如存储大小转换成可读的单位等 日志操作 logtoo原创 2020-07-07 10:37:09 · 1300 阅读 · 0 评论 -
Golang国内高速代理
https://goproxy.cn/Go 1.13 及以上(推荐)打开你的终端并执行$ go env -w GO111MODULE=on$ go env -w GOPROXY=https://goproxy.cn,direct完成。macOS 或 Linux打开你的终端并执行$exportGO111MODULE=on$exportGOPROXY=https://goproxy.cn或者$echo...原创 2020-07-21 09:30:49 · 928 阅读 · 0 评论 -
Goland 设置 Sftp : 上传和下载文件
1. 安装2. 配置远程端原创 2020-07-06 11:18:51 · 2968 阅读 · 0 评论 -
Golang:Module And Goland配置
go help modulesgo mod命令download download modules to local cache (下载依赖的module到本地cache))edit edit go.mod from tools or scripts (编辑go.mod文件)graph print module requirement graph (打印模块依赖图))init initialize new module in current d...原创 2020-07-06 21:30:19 · 1084 阅读 · 0 评论 -
Go编程基础 : 时间格式字符串
// 来自github.com\mattn\go-sqlite3@v1.14.0\sqlite3.govar SQLiteTimestampFormats = []string{ // By default, store timestamps with whatever timezone they come with. // When parsed, they will be returned with the same timezone. "2006-01-02 15:04:05.999999.原创 2020-07-06 21:34:39 · 451 阅读 · 0 评论 -
Golang: CGo - 交叉编译
1.panic: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub [recovered] panic: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub交叉编译的文件放到arm架构linux系统的平台上运行, 发现无法进行...原创 2020-07-07 08:40:45 · 13256 阅读 · 9 评论 -
golang ui执行文件多显示了个终端
编译参数多加上 -ldflags="-H windowsgui"原创 2020-07-21 16:46:21 · 384 阅读 · 0 评论 -
Golang: 关于时间字符串转time.Time
var timeTemplates = []string { "2006-01-02 15:04:05", //常规类型 "2006/01/02 15:04:05", "2006-01-02", "2006/01/02", "15:04:05",}/* 时间格式字符串转换 */func TimeStringToGoTime(tm string) time.Time { for i := range timeTemplates { t, err := time.ParseInLoca.原创 2021-03-04 08:21:38 · 7071 阅读 · 1 评论 -
Golang 收藏: 编程模式系列
一. 切片,接口,时间和性能https://mp.weixin.qq.com/s/0yLVkQ4kJLlvk5Vfz0lQkA二. 错误处理https://mp.weixin.qq.com/s/d502sQMSJ4CV0Lrf0t2sXA三. FUNCTIONAL OPTIONShttps://mp.weixin.qq.com/s/2RjaMky4F7LKw_Hdukv8yQ原创 2021-01-07 08:35:32 · 169 阅读 · 0 评论 -
golang: sqlite sql语句 操作插入字节数组([]byte)到BLOB字段类型
下列代码中较为特别的转换就是将字节数组写入到数据库中fmt.Sprintf("X'%x'", t) 注意插入的时候使用占位符x, 再有一个标志Xfunc toInsertSQL(dat map[string]interface{}) string { if nil == dat { return "" } var sql = "INSERT INTO " + tableName var keyStr, valueStr = "(", "(" var index = 0 var .原创 2020-12-04 13:52:01 · 2347 阅读 · 0 评论 -
Golang: grpc设置最大发送接收字节数
当接收的数据量超过了8M时, grpc报错如下 rpc error: code = ResourceExhausted desc = grpc: received message larger than max (8388613 vs. 8388608) 由上错误可知,最大接收数据大小是8M字节左右, 而有时候我们又需要传输大于此数据量的数据怎么办呢? 在GRPC库中发现了如下两个函数func MaxCallRecvMsgSize(bytes int) CallOpt...原创 2020-12-01 11:12:44 · 5077 阅读 · 0 评论 -
Golang : 有时需要参数, 有时不需要参数
简介: Golang 编程过程中, 有时候需求使用默认参数, 但Go无法在定义时创建默认值, 这里介绍使用一种方式,实现可以输入参数也可以不输入参数, 不输入参数按默认值处理的方式;func PrintMe(args ...string) { if 0 == len(args) { fmt.Println("Default Print") } else { fmt.Println(args...) } }...原创 2020-08-06 13:55:57 · 1602 阅读 · 0 评论 -
golang : grpc : error while marshaling: proto: Marshal called with nil
ERROR: 2020/07/28 17:05:54 grpc: server failed to encode response: rpc error: code = Internal desc = grpc: error while marshaling: proto: Marshal called with nil原因是返回值为nil, 将返回值设置回需要返回的结构即可, 发现返回成功, 其实原因是grpc传输经过一程编码,由于返回值结构为nil, 导致了编码失败...原创 2020-07-28 17:08:53 · 9764 阅读 · 0 评论 -
golang: grpc: received message larger than max
rpc error: code = ResourceExhausted desc = grpc: received message larger than max (5533721 vs. 4194304)意思就是接收信息大小大于设置了,客户端报错// 增加调用选项 grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(recvSize)))grpc.Dial(host, grpc.WithInsecure(), grpc.WithDefa.原创 2020-07-27 08:44:58 · 7320 阅读 · 0 评论 -
Golang: 文件监控模块
package mainimport ( "github.com/gogf/gf/os/gfsnotify" "github.com/gogf/gf/os/glog")func main() { // /home/john/temp 是一个目录,当然也可以指定文件 path := "/home/john/temp" _, err := gfsnotify.Add(path, func(event *gfsnotify.Event) { if.原创 2020-07-24 17:33:03 · 1512 阅读 · 0 评论 -
Golang:github.com/ant0ine/go-json-rest
package mainimport ( "fmt" "github.com/ant0ine/go-json-rest/rest" "log" "net/http" "sync")func main() { api := rest.NewApi() api.Use(rest.DefaultDevStack...) router, err := rest.MakeRouter( rest.Get("/countries", GetAllCountries), rest.Po.原创 2020-07-21 22:39:57 · 316 阅读 · 0 评论 -
Go使用库 - 美其名曰避免重复造轮子
1. go-json-rest github.com/ant0ine/go-json-rest/rest原创 2020-07-21 17:16:00 · 1244 阅读 · 0 评论