go generate
执行 go generate 命令时,会执行 //go:generate 之后的命令,注意 // 后面没有空格。 //go:generate 可以放在已有代码的任何位置,或者单独新建 go 文件用于各种 //go:generate 指令。
深度截图
前面提到深度的截图工具会自动给截图增加一个蓝色的边框,看上去很怪异,所以自己打了个补丁。 不是很清楚为何官方的版本默认是无
JetBrains 学生账号
前些天想要买 GoLand 的 license(价格其实并不贵): 但是,在官网看了一下如果之前拥有学生账号,那么可以有 25% 的折扣: 为了这 25%
使用 GoLand 调试 Go 程序
命令行上对 Go 程序进行调试在变量打印等方面的友好性相比图形界面还是要差很多,而且 dlv 相比 gdb 还缺少 tui 窗口,在源代码查看方面更是
git gpg 签名
查找到需要用于 gpg 签名的密钥对 id: ~$ gpg -k /home/runsisi/.gnupg/pubring.gpg -------------------------------- pub rsa2048/759D8517 2018-01-06 [SC] 2915D352D6652715FB9AB146C08D7AE1759D8517 uid [ultimate] dev <dev@example.com> sub rsa2048/1B971CBF 2018-01-06 [E] pub rsa3072/C7E8A950 2019-04-13 [SC] [expires: 2021-04-12] 6DF6CFC20424F5CA2BC540E768CCC50DC7E8A950 uid [ultimate] luo.runbing (https://www.example.com/) <luo.runbing@example.com> uid [ultimate] runsisi (https://runsisi.com/) <runsisi@hust.edu.cn> sub rsa3072/D2E0CB2D 2019-04-13 [E] [expires: 2021-04-12] sub rsa3072/8D77F675
镜像 github 项目到本地 gitlab 环境
mirror 脚本: #!/bin/bash -x # runsisi AT hust.edu.cn export LANG=C export LC_ALL=C # mirror.conf MIRROR_CONF="mirror.conf" export HTTPS_PROXY=http://proxy123.example.com:12345 export HTTP_PROXY=$HTTPS_PROXY export NO_PROXY=src.example.com # parse a string like this: # src [localdir] mirror [refspec], e.g., # https://github.com/ceph/ceph.git ceph http://src.example.com/runsisi/ceph.git --tags master firefly giant hammer # or # https://github.com/ceph/ceph.git ceph-ci http://src.example.com/runsisi/ceph.git --tags # or # https://gitbhu.com/ceph/ceph.git http://src.example.com/runsisi/ceph.git do_parse() { local line_="$1"
git tag
git 可以创建两种类型的 tag,一种类似于 commit 的别名,没有任何多余的信息附加在该 tag 之上,称作 lightweight tag,如果在创建 tag 时不指定 -a, -s
操作 GPG 密钥对
注意本文仅针对 gpg2,gpg1 的使用与此类似,但在命令输出上可能存在一些不同。 在 Ubuntu18.04 下,/usr/bin/gpg2 是指向
git 使用 tips
查看配置 $ git config -l user.name=runsisi@hust.edu.cn user.email=runsisi@hust.edu.cn alias.br=branch alias.st=status alias.ci=commit alias.co=checkout alias.cp=cherry-pick alias.log1=log --oneline ... 基本配置 $ git config --global user.name runsisi $ git config --global user.name runsisi@hust.edu.cn $ git config --global core.editor vim $ git config --global log.date local $ git config --global diff.tool vimdiff $ git config --global merge.tool vimdiff $ git
Go 程序调试
Go 程序的调试可以使用 gdb 或者 dlv,但 dlv 在打印变量内容、调试 goroutine 等方面对 Go 的支持比 gdb 要好很多。 dlv dlv v1.2.0 版本好像存在 bug,dl