goang

  • gossh go写的开源工具 批量操作服务器
    文章 更新时间:

    gossh go写的开源工具 批量操作服务器 https://github.com/andesli/gossh [ ](https://cf.maocaoying.com/images/2023/02/14/7259955079bd0ad487e395d65757f6be.png) gossh提供3种核心功能: 连接到

  • go get -u
    文章 更新时间:

    go get u go get u update 的意思

  • GOST- GO Simple Tunnel
    文章 更新时间:

    GOST GO Simple Tunnel [ ](https://cf.maocaoying.com/images/2023/02/16/4d7033640215d70ba462840c0d800c5b.png) https://v2.gost.run/ 多端口监听 可设置转发代理,支持多级转发(代理链) 支持标准H

  • golang 空结构体 struct{} 作用
    文章 更新时间:

    golang 空结构体 struct{} 作用 原文地址 [segmentfault.com](https://segmentfault.com/a/1190000040799205) 大家好,我是煎鱼。在 Go 语言中,有一个比较特殊的类型,经常会有刚接触 Go 的小伙伴问到,又或是不理解。他就是 Go 里的空结构体

  • go 项目目录结构 规范
    文章 更新时间:

    go 项目目录结构 规范 原文地址 [github.com](https://github.com/golangstandards/projectlayout/blob/master/READMEzh.md) [](standardgoprojectlayout)Standard Go Project Layout =

  • golang Prometheus
    文章 更新时间:

    golang Prometheus 参考代码: OpenIMServer 基础: https://www.maocaoying.com/topic/950 http : if config.Config.Prometheus.Enable { promePkg.NewApiRequestCounter() promeP

  • golang context
    文章 更新时间:

    golang context 什么是context? context是一种通知手段,例如现在后台有一个监听进程,你要如何在主进程中停止这个监听进程呢?有人会说,select+channel好了嘛,只要主进程往channel里面写数据,后台监听进程读取到channel里面的数据就停止,这其实是一个不错的方法,但是如果后台

  • golang context emptyCtx valueCtx cancelCtx timerCtx
    文章 更新时间:

    golang context emptyCtx valueCtx cancelCtx timerCtx https://juejin.cn/post/7085190229782429727 context 包提供了四种实现了 Context 接口的 struct。分别为最基础的 emptyCtx,包含键值对的 valu

  • golang struct{} 一个作为key的用法
    文章 更新时间:

    golang struct{} 一个作为key的用法 type keyType struct{} //空struct{}作为key,不占用内存空间 var xxxKey struct{} //同时避免了不同包使用ctx传值时出现冲突 var xxxKey2 keyType // 如果也是struct{} 。那么会覆盖。

  • 基于 context.Context 的 Golang loader 缓存
    文章 更新时间:

    基于 context.Context 的 Golang loader 缓存 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 [juejin.cn](https://juejin.cn/post/7154318373663277093) 请求放大的问题。 做了

  • golang 函数选项模式
    文章 更新时间:

    golang 函数选项模式 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 [mp.weixin.qq.com](https://mp.weixin.qq.com/s/gCMLQobQjnXGnefkrJQ) 前言 通过这篇文章《[为什么说 Go 的函数是”

  • gomobile 开发android IOS SDK
    文章 更新时间:

    gomobile 开发android IOS SDK https://github.com/golang/mobile https://pkg.go.dev/golang.org/x/mobile The Go mobile repository holds packages and build tools for u

  • 当 Go struct 遇上 Mutex
    文章 更新时间:

    当 Go struct 遇上 Mutex 原文地址 [juejin.cn](https://juejin.cn/post/6912265131619516430) struct 是我们写 Go 必然会用到的关键字, 不过当 struct 遇上一些比较特殊类型的时候, 你注意过你的程序是否正常吗 ? 一段代码 type

  • go json.RawMessage
    文章 更新时间:

    go json.RawMessage // RawMessage is a raw encoded JSON value. // It implements Marshaler and Unmarshaler and can // be used to delay JSON decoding or precompute

  • golang cobra 命令库
    文章 更新时间:

    golang cobra 命令库 https://darjun.github.io/2020/01/17/godailylib/cobra/ 这篇文章提取摘要 [ ](https://cf.maocaoying.com/images/2023/12/07/b8bdfe6de036b9b56ef87587ca39e897

  • golang viper库
    文章 更新时间:

    golang viper库 viper 是一个配置解决方案,拥有丰富的特性: 支持 JSON/TOML/YAML/HCL/envfile/Java properties 等多种格式的配置文件; 可以设置监听配置文件的修改,修改时自动加载新的配置; 从环境变量、命令行选项和io.Reader中读取配置; 从远程配置系统中

  • 一图直接懂gomod配置
    文章 更新时间:

    一图直接懂gomod配置 一图直接懂gomod配置 golang的go.mod的层级嵌套问题 [](https://cf.maocaoying.com/images/2023/03/03/07cdb6998b5426dec89c2ee98b941920.png)

  • go pflag vs flag
    文章 更新时间:

    go pflag vs flag pflag 包与 flag 包的工作原理甚至是代码实现都是类似的,下面是 pflag 相对 flag 的一些优势: 支持更加精细的参数类型:例如,flag 只支持 uint 和 uint64,而 pflag 额外支持 uint8、uint16、int32 等类型。 支持更多参数类型:i

  • golang 交叉编译
    文章 更新时间:

    golang 交叉编译 GOOS: 目标平台的操作系统(darwin freebsd linux windows) GOARCH 目标平台的架构是32位或64位(386 amd64 arm) GOOS=linux GOARCH="amd64" go build o cmd 386 代表 32 位系统,也称为 i386。

  • go 参数校验 GoFrame/gvalid vs go-playground/validator
    文章 更新时间:

    go 参数校验 GoFrame/gvalid vs goplayground/validator 原文地址 [zhuanlan.zhihu.com](https://zhuanlan.zhihu.com/p/268935539) GoFrame——数据校验之结构体校验 GoFrame中gvalid模块实现了非常强大的数

  • Go Test 单元测试简明教程 | 快速入门
    文章 更新时间:

    Go Test 单元测试简明教程 | 快速入门 [ ](https://cf.maocaoying.com/images/2023/03/04/b7945b7b80664244369bb9b6a395463f.png) 原文 https://geektutu.com/post/quickgotest.html 测试用例

  • golang lo库 -stream处理
    文章 更新时间:

    golang lo库 stream处理 ✨ samber/lo is a Lodashstyle Go library based on Go 1.18+ Generics. 采用泛型。工具类库 stream处理 It may look like [Lodash](https://github.com/lodash/l

  • go singleflight 缓存击穿 缓存一致性
    文章 更新时间:

    go singleflight 缓存击穿 缓存一致性 一致性 [一致性问题](https://cf.maocaoying.com/images/2023/03/05/8cdd8f38bcea7105a540634019c7a8c7.png) 2个线程 协程,因为先后顺序不同,导致 最后update cache时候,不一

  • 不要忽略 goroutine 的启动时间, for range 陷阱
    文章 更新时间:

    不要忽略 goroutine 的启动时间, for range 陷阱 原文地址 [mp.weixin.qq.com](https://mp.weixin.qq.com/s/P2FDJHvFTx516yHioxULkg) 小菜刀的项目中需要将数据推给多个服务器,大致如下 1package main 2 3import (

  • golang gout http 工具
    文章 更新时间:

    golang gout http 工具 支持链式 package main import ( "fmt" "github.com/guonaihong/gout" "time" ) // 用于解析 服务端 返回的http body type RspBody struct { ErrMsg string json:"er