diff --git a/.github/workflows/upload.yaml b/.github/workflows/upload.yaml index 711c699b..7bd857f0 100644 --- a/.github/workflows/upload.yaml +++ b/.github/workflows/upload.yaml @@ -90,7 +90,7 @@ jobs: # 测试第三方仓库(https://github.com/jzero-io/templates)模板 rm -rf simplerpc-goctl jzero new simplerpc-goctl --branch rpc-goctl - cd simplerpc-goctl && jzero gen --home ~/.jzero/templates/rpc-goctl + cd simplerpc-goctl && jzero gen jzero gen swagger jzero gen zrpcclient go mod tidy && go mod download diff --git a/cmd/gen.go b/cmd/gen.go index 1f382240..0316632f 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -11,6 +11,7 @@ import ( "path/filepath" "strings" + "github.com/mitchellh/go-homedir" "github.com/spf13/cobra" "github.com/zeromicro/go-zero/core/color" "github.com/zeromicro/go-zero/tools/goctl/util/console" @@ -49,6 +50,7 @@ var genCmd = &cobra.Command{ }, RunE: func(cmd *cobra.Command, args []string) error { home, _ := os.UserHomeDir() + config.C.Gen.Home, _ = homedir.Expand(config.C.Gen.Home) if !pathx.FileExists(config.C.Gen.Home) { config.C.Gen.Home = filepath.Join(home, ".jzero", Version) } diff --git a/go.mod b/go.mod index 4ac77ee4..c2a409d5 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/iancoleman/orderedmap v0.3.0 github.com/jhump/protoreflect v1.16.0 github.com/jzero-io/desc v0.0.1 + github.com/mitchellh/go-homedir v1.1.0 github.com/pkg/errors v0.9.1 github.com/rinchsan/gosimports v0.3.8 github.com/samber/lo v1.47.0 diff --git a/go.sum b/go.sum index 753c8c0d..8558679a 100644 --- a/go.sum +++ b/go.sum @@ -129,6 +129,8 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=