Less than 1 minute
声明变量
var name string = "huhx"
var name = "huhx"
name: "huhx"
var name, address string = "huhx", "hubei"
var name, address = "huhx", "hubei"
name, address := "huhx", "hubei"
About 1 min
cobra
cobra-cli
# install
go install github.com/spf13/cobra-cli@latest
# 如果执行安装了,cobra-cli command not found,对么参考:https://github.com/spf13/cobra/issues/1964
# create repo
mkdir demo && cd demo
# download dependencies
go mod init demo
go mod tidy
# more
cobra-cli init --author "huhx" --viper --license apache
touch $HOME/.demo.yaml
# add command
cobra-cli add team
cobra-cli add create -p 'teamCmd'
Less than 1 minute
aliyun-oss sdk
viper config
current: local
local:
path:
name:
remote:
bucket:
key-id:
key-secret:
OriginalLess than 1 minute