kratos/gomod_file (#38)

* add gomod file generation
* fix kratos tool init mod
pull/40/head
zhaoshichen1 6 years ago committed by Felix Hao
parent 72123ada7d
commit 22cae18871
  1. 4
      go.mod
  2. 3
      tool/kratos/project.go
  3. 28
      tool/kratos/template.go

@ -29,7 +29,7 @@ require (
github.com/urfave/cli v1.20.0
golang.org/x/net v0.0.0-20190311183353-d8887717615a
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
google.golang.org/grpc v1.18.0
google.golang.org/grpc v1.20.1
gopkg.in/AlecAivazis/survey.v1 v1.8.2
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v9 v9.26.0
@ -48,5 +48,5 @@ replace (
golang.org/x/tools => github.com/golang/tools v0.0.0-20190328211700-ab21143f2384
google.golang.org/appengine => github.com/golang/appengine v1.1.0
google.golang.org/genproto => github.com/google/go-genproto v0.0.0-20180817151627-c66870c02cf8
google.golang.org/grpc => github.com/grpc/grpc-go v1.18.0
google.golang.org/grpc => github.com/grpc/grpc-go v1.20.1
)

@ -38,6 +38,7 @@ const (
_tplTypeModel
_tplTypeGRPCServer
_tplTypeAPIGenerate
_tplTypeGomod
)
var (
@ -49,6 +50,7 @@ var (
_tplTypeContributors: "/CONTRIBUTORS.md",
_tplTypeReadme: "/README.md",
// init project
_tplTypeGomod: "/go.mod",
_tplTypeMain: "/cmd/main.go",
_tplTypeDao: "/internal/dao/dao.go",
_tplTypeHTTPServer: "/internal/server/http/http.go",
@ -78,6 +80,7 @@ var (
_tplTypeAppToml: _tplAppToml,
_tplTypeHTTPToml: _tplHTTPToml,
_tplTypeModel: _tplModel,
_tplTypeGomod: _tplGoMod,
}
)

@ -417,6 +417,34 @@ message HelloReq {
type Kratos struct {
Hello string
}`
_tplGoMod = `module {{.Name}}
go 1.12
require (
github.com/bilibili/kratos v0.0.0-20190417043059-a08e0f771592
github.com/gogo/protobuf v1.2.1
github.com/golang/protobuf v1.3.1
golang.org/x/net v0.0.0-20190420063019-afa5a82059c6
google.golang.org/grpc v1.20.1
)
replace (
cloud.google.com/go => github.com/googleapis/google-cloud-go v0.26.0
golang.org/x/crypto => github.com/golang/crypto v0.0.0-20190123085648-057139ce5d2b
golang.org/x/lint => github.com/golang/lint v0.0.0-20181026193005-c67002cb31c3
golang.org/x/net => github.com/golang/net v0.0.0-20190311183353-d8887717615a
golang.org/x/oauth2 => github.com/golang/oauth2 v0.0.0-20180821212333-d2e6202438be
golang.org/x/sync => github.com/golang/sync v0.0.0-20181108010431-42b317875d0f
golang.org/x/sys => github.com/golang/sys v0.0.0-20180905080454-ebe1bf3edb33
golang.org/x/text => github.com/golang/text v0.3.0
golang.org/x/time => github.com/golang/time v0.0.0-20190308202827-9d24e82272b4
golang.org/x/tools => github.com/golang/tools v0.0.0-20190328211700-ab21143f2384
google.golang.org/appengine => github.com/golang/appengine v1.1.0
google.golang.org/genproto => github.com/google/go-genproto v0.0.0-20180817151627-c66870c02cf8
google.golang.org/grpc => github.com/grpc/grpc-go v1.20.1
)
`
_tplGRPCServer = `package grpc
import (

Loading…
Cancel
Save