常用笔记

常用笔记

Golang

proxy

GOPROXY=https://goproxy.cn,direct

build

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
go build -tags=prod -ldflags "-s -w" -o app main.go

mod

go mod init name
go mod tidy

env

go install -ldflags "-w -s" github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest
go install -ldflags "-w -s" github.com/ramya-rao-a/go-outline@latest
go install -ldflags "-w -s" github.com/cweill/gotests/gotests@latest
go install -ldflags "-w -s" github.com/fatih/gomodifytags@latest
go install -ldflags "-w -s" github.com/josharian/impl@latest
go install -ldflags "-w -s" github.com/haya14busa/goplay/cmd/goplay@latest
go install -ldflags "-w -s" github.com/go-delve/delve/cmd/dlv@master
go install -ldflags "-w -s" honnef.co/go/tools/cmd/staticcheck@latest
go install -ldflags "-w -s" golang.org/x/tools/gopls@latest
go install -ldflags "-w -s" github.com/swaggo/swag/cmd/swag@latest

Python

pip

-i https://pypi.tuna.tsinghua.edu.cn/simple
pip install 你需要的包 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip upgrade

python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple

Nodejs

npm error

npm ERR! Could not install from "Files\nodejs\node_cache\_npx\12848" as it does not contain a package.json file.

npm config set cache "D:\Program Files\nodejs\node_cache"--global

Vue

vuex

  • commit: 同步操作
this.$store.commit('asyncFnVal',name)
this.$store.state.val
  • dispatch: 异步操作
this.$store.dispatch('syncFnVal',name)
this.$store.getters.getVal

Swagger

  • 折叠api
http://xxxxx/swagger/index.html?docExpansion

Git

  • 从记录中删除
    • 删除记录 git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch path-to-your-remove-file' --prune-empty --tag-name-filter cat -- --all
    • 强制推送修改 git push origin master -f
    • 删除标签记录 git push origin master --force --tags
    • 清理和回收空间
      • rm -rf .git/refs/original/
      • git reflog expire --expire=now --all
      • git gc --prune=now