Author: chiachan

go语言学习笔记 - channal实战

Worker 池并发任务处理器 package main import ( "fmt" "sync" "time" ) type Task struct { ID int } func (t Task) Do() { fmt.Printf("任务 %d

chiachan Published on 2025-01-22

go语言学习笔记 - channal

Go语言笔记 - Channel 1. 什么是channel Channel 是 Go 语言中用来在 goroutine 之间传递数据的通信机制,本质上像一个管道(队列),可以安全地在线程之间传数据,避免加锁。 通俗点说,Channel 就是 goroutine 之间用来**发送(send)和接收(

chiachan Published on 2025-01-19

对kratos服务进行颜色标签过滤

解决如何对kratos服务进行颜色标签过滤 应用场景 生产环境下新功能测试 带标签状态的需求 对来源用户进行分类服务划分 给服务打上color标签 在main.go中,metadata加入color标签即可,可以参考一下方式。从启动命令中读取 ... func init() { flag.Stri

chiachan Published on 2025-01-09

谜题排查:concurrent map read and map write报错

问题 今天收到同事发来的报错concurrent map read and map write 报错位置源码如下: var data = make(map[string]int64, 100) func GetValue(name string) int64 { return data[name

chiachan Published on 2025-01-09

go语言的Mutex和RWMutex

golang 中的 sync 包实现了两种锁: Mutex:互斥锁 RWMutex:读写锁,RWMutex 基于 Mutex 实现 Mutex(互斥锁) Mutex 为互斥锁,Lock() 加锁,Unlock() 解锁 在一个 goroutine 获得 Mutex 后,其他 goroutine 只能

chiachan Published on 2025-01-09

debian12安装k8s环境(minikube)

安装docker root@debian:~# apt install apt-transport-https ca-certificates curl software-properties-common ... root@debian:~# curl -fsSL https://downloa

chiachan Published on 2025-01-08

go语言学习笔记 - 数组与切片

go语言学习笔记 - 数组与切片 数组(Array)是定长的值类型。是一段连续的内容 切片(Slice)是动态的引用类型。是一个结构体 数组(Array) var arr [3]int = [3]int{1, 2, 3} 特点: 固定长度:[3]int 是一个长度为 3 的数组类型。 值类型:传参

chiachan Published on 2025-01-06

vscode golang环境

安装githistory和gitLens插件;安装go插件

chiachan Published on 2024-12-30

移动光猫获取超级用户密码(ZN-AX171G)

于光猫拨号经常性有问题,需要断电重连。所以想着改成桥接模式,把拨号功能换到路由器。 于是乎,需要光猫的账号密码。我是今年3月份装了宽带,光猫版本比较新, 新版光猫很多方式都不生效了,包括万能超级用户密码、telenet进去查看 尝试了很多方式,都无法成功。还以为这个光猫就废掉了。但是.... 新方法

chiachan Published on 2024-12-30

安装ikuai代理路由器拨号(虚拟机篇)

背景 由于关闭ipv6防火墙可能带来巨大的安全问题,现有的tplink xdr5480路由器仅有一个防火墙开关,无法控制端口或设备防火墙。 在不增加硬件设备的情况下,考虑更改路由器固件,但不可行。 最后决定使用以下方案来解决 思路 在绿联虚拟机上安装ikuai,一个端口连接光猫进行拨号,另一个端口连

chiachan Published on 2024-12-25
Previous Next