如何基于 Node.js 构建并发布一个 CLI 命令行工具

CLI 命令行工具是很常见的应用,之前会用 Golang/Rust 等语言构建过一些 CLI 工具,但是这次将基于 Node.js 构建一个 CLI 命令行工具,同时将其发布到官方的 NPM Registry npmjs.com 上,方便其他人可以下载使用。 ...

January 19, 2022 · 2 min · K8sCat

Go json 自定义 Unmarshal 避免判断 nil

腾讯《Go安全指南》中提到【必须】nil指针判断:进行指针操作时,必须判断该指针是否为nil,防止程序panic,尤其在进行结构体Unmarshal时。但如果每次使用都要判断一下是否 nil 防止 panic的话,那么这样的代码就会比较麻烦,这里我们可以使用一个自定义的方法,来避免这种情况。 ...

December 4, 2021 · 1 min · K8sCat

Git 签名失败: gpg failed to sign the data

在 Goland 里使用 GPG 签名时提示错误: error: gpg failed to sign the data fatal: failed to write commit object ...

November 22, 2021 · 1 min · K8sCat

GOPROXY 引发依赖 hash 校验不通过

使用不同的 GOPROXY 下载依赖时,依赖的 hash 校验无法通过。 ...

October 14, 2021 · 2 min · K8sCat

How to disable `auto cd` in zsh with oh-my-zsh

I have a binary file named x in my path (not the current folder, but it is in the PATH), and also a folder with the same name in the current working directory. If I type x, I want the binary to execute, but instead it cd’s into that folder. How do I fix this? ...

October 7, 2021 · 1 min · K8sCat

SSH 端口转发与 SOCKS 代理

September 22, 2021 · 1 min · K8sCat

[cURL] 指定请求使用的 SOCKS 代理

记录一下 cURL 设置 SOCKS 代理的方式。 ...

September 22, 2021 · 1 min · K8sCat

Resolved: VSCode Go Error loading workspace

September 3, 2021 · 1 min · K8sCat