Skip to content

Commit

Permalink
fix(gen): fix home with prefix ~
Browse files Browse the repository at this point in the history
  • Loading branch information
jaronnie committed Nov 25, 2024
1 parent e4e9fd7 commit 5875049
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions cmd/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 5875049

Please sign in to comment.