From 0552b69b36425a34569b1443b11d83466c2e818e Mon Sep 17 00:00:00 2001 From: naiba Date: Mon, 25 Nov 2024 22:03:11 +0800 Subject: [PATCH] refactor: replace pflag with standard flag package in main.go --- cmd/dashboard/main.go | 7 +++---- go.mod | 1 - go.sum | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index b97b70d..664b0b1 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "flag" "fmt" "log" "net" @@ -12,7 +13,6 @@ import ( _ "time/tzdata" "github.com/ory/graceful" - flag "github.com/spf13/pflag" "golang.org/x/crypto/bcrypt" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" @@ -90,9 +90,8 @@ func initSystem() { // @externalDocs.description OpenAPI // @externalDocs.url https://swagger.io/resources/open-api/ func main() { - flag.CommandLine.ParseErrorsWhitelist.UnknownFlags = true - flag.BoolVarP(&dashboardCliParam.Version, "version", "v", false, "查看当前版本号") - flag.StringVarP(&dashboardCliParam.ConfigFile, "config", "c", "data/config.yaml", "配置文件路径") + flag.BoolVar(&dashboardCliParam.Version, "v", false, "查看当前版本号") + flag.StringVar(&dashboardCliParam.ConfigFile, "c", "data/config.yaml", "配置文件路径") flag.StringVar(&dashboardCliParam.DatebaseLocation, "db", "data/sqlite.db", "Sqlite3数据库文件路径") flag.Parse() diff --git a/go.mod b/go.mod index 2762647..544fbc8 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,6 @@ require ( github.com/oschwald/maxminddb-golang v1.13.1 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/robfig/cron/v3 v3.0.1 - github.com/spf13/pflag v1.0.5 github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 github.com/swaggo/swag v1.16.4 diff --git a/go.sum b/go.sum index cbecfde..f4dcb0a 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,6 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=