Ai
1 Star 0 Fork 0

player1/restful-api-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
root.go 483 Bytes
一键复制 编辑 原始数据 按行查看 历史
player1 提交于 2024-02-18 15:17 +08:00 . 完成Makefile的版本信息注入命令行执行
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"gitee.com/player1111/restful-api-demo.git/version"
)
var vers bool
var RootCmd = &cobra.Command{
Use: "demo-api",
Short: "demo-backend-api",
Long: "demo-backend-api",
RunE: func(cmd *cobra.Command, args []string) error {
if vers {
fmt.Println(version.FullVersion())
return nil
}
return nil
},
}
func init() {
RootCmd.PersistentFlags().BoolVarP(&vers, "version", "v", false, "Version Information")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/player1111/restful-api-demo.git
git@gitee.com:player1111/restful-api-demo.git
player1111
restful-api-demo
restful-api-demo
19fd67857982

搜索帮助