Skip to content

Instantly share code, notes, and snippets.

View baojiliu's full-sized avatar
🌴
On vacation

baojiliu

🌴
On vacation
View GitHub Profile
@baojiliu
baojiliu / Remove all git tags
Created September 6, 2022 11:11 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@baojiliu
baojiliu / addimport.go
Created June 14, 2022 10:28 — forked from josephspurrier/addimport.go
Add Import using ast in Go
// Source: https://gitlab.pro/googlesource/tools/blob/ae534bcb6ccdd13487d0491c2194d10ebcd30ff3/astutil/imports.go
// Source: https://golang.org/src/go/doc/example.go#L262
package main
import (
"bytes"
"fmt"
"go/ast"
"go/parser"
@baojiliu
baojiliu / ast_print_struct_fields.go
Created November 9, 2021 10:53 — forked from imantung/ast_print_struct_fields.go
Print struct field using golang AST
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
var src = `package mypackage