GrantZheng / kit

GoKit CLI
MIT License
268 stars 54 forks source link

hello, there are some bugs when I used "kit g s hello --dmw" command. #28

Closed lxxwilliam closed 2 years ago

lxxwilliam commented 2 years ago

PS D:\projects\go-kit\mydemo> kit g s hello --dmw panic: Error 5:9: invalid import path: "D:/projects/go-kit/mydemo/hello/pkg/service" while formatting source: // THIS FILE IS AUTO GENERATED BY GK-CLI DO NOT EDIT!! package endpoint

import ( service "D:/projects/go-kit/mydemo/hello/pkg/service" endpoint "github.com/go-kit/kit/endpoint" )

    D:/go-sdk/go-repository/pkg/mod/github.com/kujtimiihoxha/kit@v0.1.1/cmd/g_service.go:41 +0x17c

github.com/spf13/cobra.(Command).execute(0x1131220, {0xc00005ff80, 0x2, 0x2}) D:/go-sdk/go-repository/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:860 +0x5f8 github.com/spf13/cobra.(Command).ExecuteC(0x1130aa0) D:/go-sdk/go-repository/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:974 +0x3bc github.com/spf13/cobra.(*Command).Execute(...) D:/go-sdk/go-repository/pkg/mod/github.com/spf13/cobra@v1.3.0/command.go:902 github.com/kujtimiihoxha/kit/cmd.Execute() D:/go-sdk/go-repository/pkg/mod/github.com/kujtimiihoxha/kit@v0.1.1/cmd/root.go:24 +0x25 main.main() D:/go-sdk/go-repository/pkg/mod/github.com/!grant!zheng/kit@v1.0.2/main.go:14 +0x2b

bootun commented 2 years ago

How do you install kit cli? if you use go install github.com/GrantZheng/kit@x.x.x, then you installed the old version, cause the repo owner has not released the new version yet.

$ git clone github.com/GrantZheng/kit
$ cd kit
$ go install

that can solve the version problem, if the problem occurs again at the new version, report it in this issue

lxxwilliam commented 2 years ago

How do you install kit cli? if you use go install github.com/GrantZheng/kit@x.x.x, then you installed the old version, cause the repo owner has not released the new version yet.

$ git clone github.com/GrantZheng/kit
$ cd kit
$ go install

that can solve the version problem, if the problem occurs again at the new version, report it in this issue

hi, I done it what you said, but there is another problem like this PS D:\projects\go-kit\mydemo> kit new service hello genModule: sh -c cd hello && go mod init hello => err:exec: "sh": executable file not found in %PATH% , time="2022-01-25T14:34:05+08:00" level=error msg="genModule: sh -c cd hello && go mod init hello => err:exec: \"sh\": executable file not found in %PATH% , "

bootun commented 2 years ago

See #15, I use windows too, my computer enable the WSL(Windows Subsystem for Linux) , if you won't, you can use GitBash to mock UNIX shell environment.actually that's what I did before.

lxxwilliam commented 2 years ago

See #15, I use windows too, my computer enable the WSL(Windows Subsystem for Linux) , if you won't, you can use GitBash to mock UNIX shell environment.actually that's what I did before.

thanks, the command can be work when I used git bash, but the imports of the created files can not be download, might because of my go sdk version is 1.17? and I have to change the version? hello/cmd/service imports github.com/prometheus/client_golang/prometheus imports github.com/golang/protobuf/proto tested by github.com/golang/protobuf/proto.test imports github.com/google/go-cmp/cmp imports github.com/google/go-cmp/cmp/internal/value loaded from github.com/google/go-cmp@v0.5.5, but go 1.16 would select v0.5.6

To upgrade to the versions selected by go 1.16: go mod tidy -go=1.16 && go mod tidy -go=1.17 If reproducibility with go 1.16 is not needed: go mod tidy -compat=1.17 For other options, see: https://golang.org/doc/modules/pruning

bootun commented 2 years ago

You can choose a command to execute according to your needs: https://go.dev/ref/mod#graph-pruning

lxxwilliam commented 2 years ago

You can choose a command to execute according to your needs: https://go.dev/ref/mod#graph-pruning

thanks

bootun commented 2 years ago

now we release the new version, you can uses go install github.com/GrantZheng/kit@latest to install kit cli