diff --git a/.licenserc.yaml b/.licenserc.yaml index f602f7c..4ca3801 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -9,6 +9,6 @@ header: paths-ignore: - pkg/common/testdata/** - - cmd/hz/internal/protobuf/api + - cmd/hz/protobuf/api comment: on-failure diff --git a/cmd/hz/internal/app/app.go b/cmd/hz/app/app.go similarity index 91% rename from cmd/hz/internal/app/app.go rename to cmd/hz/app/app.go index 05789ed..d8b8139 100644 --- a/cmd/hz/internal/app/app.go +++ b/cmd/hz/app/app.go @@ -19,13 +19,17 @@ package app import ( "errors" "fmt" + "os" + "path/filepath" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/config" - "github.com/cloudwego/hertz/cmd/hz/internal/generator" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/config" + "github.com/cloudwego/hertz/cmd/hz/generator" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/protobuf" + "github.com/cloudwego/hertz/cmd/hz/thrift" + "github.com/cloudwego/hertz/cmd/hz/util" + "github.com/cloudwego/hertz/cmd/hz/util/logs" "github.com/urfave/cli/v2" ) @@ -40,12 +44,12 @@ func New(c *cli.Context) error { setLogVerbose(args.Verbose) logs.Debugf("args: %#v\n", args) - err = generateLayout(args) + err = GenerateLayout(args) if err != nil { return cli.Exit(err, meta.GenerateLayoutError) } - err = triggerPlugin(args) + err = TriggerPlugin(args) if err != nil { return cli.Exit(err, meta.PluginError) } @@ -67,7 +71,7 @@ func Update(c *cli.Context) error { setLogVerbose(args.Verbose) logs.Debugf("Args: %#v\n", args) - err = triggerPlugin(args) + err = TriggerPlugin(args) if err != nil { return cli.Exit(err, meta.PluginError) } @@ -88,7 +92,7 @@ func Model(c *cli.Context) error { setLogVerbose(args.Verbose) logs.Debugf("Args: %#v\n", args) - err = triggerPlugin(args) + err = TriggerPlugin(args) if err != nil { return cli.Exit(err, meta.PluginError) } @@ -96,6 +100,21 @@ func Model(c *cli.Context) error { return nil } +func PluginMode() { + pluginName := filepath.Base(os.Args[0]) + if util.IsWindows() { + pluginName = strings.TrimSuffix(pluginName, ".exe") + } + switch pluginName { + case meta.ThriftPluginName: + plugin := new(thrift.Plugin) + os.Exit(plugin.Run()) + case meta.ProtocPluginName: + plugin := new(protobuf.Plugin) + os.Exit(plugin.Run()) + } +} + func Init() *cli.App { // flags verboseFlag := cli.BoolFlag{Name: "verbose,vv", Usage: "turn on verbose mode", Destination: &globalArgs.Verbose} @@ -233,7 +252,7 @@ func setLogVerbose(verbose bool) { } } -func generateLayout(args *config.Argument) error { +func GenerateLayout(args *config.Argument) error { lg := &generator.LayoutGenerator{ TemplateGenerator: generator.TemplateGenerator{ OutputDir: args.OutDir, @@ -292,7 +311,7 @@ func generateLayout(args *config.Argument) error { return nil } -func triggerPlugin(args *config.Argument) error { +func TriggerPlugin(args *config.Argument) error { if len(args.IdlPaths) == 0 { return nil } diff --git a/cmd/hz/internal/config/argument.go b/cmd/hz/config/argument.go similarity index 98% rename from cmd/hz/internal/config/argument.go rename to cmd/hz/config/argument.go index 9191181..d4250ed 100644 --- a/cmd/hz/internal/config/argument.go +++ b/cmd/hz/config/argument.go @@ -22,8 +22,8 @@ import ( "path/filepath" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util" "github.com/urfave/cli/v2" ) diff --git a/cmd/hz/internal/config/cmd.go b/cmd/hz/config/cmd.go similarity index 97% rename from cmd/hz/internal/config/cmd.go rename to cmd/hz/config/cmd.go index 6fcbea2..b825992 100644 --- a/cmd/hz/internal/config/cmd.go +++ b/cmd/hz/config/cmd.go @@ -24,9 +24,9 @@ import ( "strings" "syscall" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util" + "github.com/cloudwego/hertz/cmd/hz/util/logs" ) func lookupTool(idlType string) (string, error) { diff --git a/cmd/hz/doc.go b/cmd/hz/doc.go new file mode 100644 index 0000000..6eff898 --- /dev/null +++ b/cmd/hz/doc.go @@ -0,0 +1,20 @@ +// Copyright 2022 CloudWeGo Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Package "github.com/cloudwego/hertz/cmd/hz" contains packages for building the hz command line tool. +// APIs exported by packages under this directory do not promise any backward +// compatibility, so please do not rely on them. + +package main diff --git a/cmd/hz/internal/generator/file.go b/cmd/hz/generator/file.go similarity index 95% rename from cmd/hz/internal/generator/file.go rename to cmd/hz/generator/file.go index eec16cc..6e0133a 100644 --- a/cmd/hz/internal/generator/file.go +++ b/cmd/hz/generator/file.go @@ -22,7 +22,7 @@ import ( "path/filepath" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/util" ) type File struct { diff --git a/cmd/hz/internal/generator/handler.go b/cmd/hz/generator/handler.go similarity index 97% rename from cmd/hz/internal/generator/handler.go rename to cmd/hz/generator/handler.go index 3445cd5..c64ef79 100644 --- a/cmd/hz/internal/generator/handler.go +++ b/cmd/hz/generator/handler.go @@ -23,9 +23,9 @@ import ( "path/filepath" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/util" + "github.com/cloudwego/hertz/cmd/hz/util/logs" ) type HttpMethod struct { diff --git a/cmd/hz/internal/generator/layout.go b/cmd/hz/generator/layout.go similarity index 98% rename from cmd/hz/internal/generator/layout.go rename to cmd/hz/generator/layout.go index e667fb4..82f566c 100644 --- a/cmd/hz/internal/generator/layout.go +++ b/cmd/hz/generator/layout.go @@ -23,7 +23,7 @@ import ( "io/ioutil" "reflect" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/util" "gopkg.in/yaml.v2" ) diff --git a/cmd/hz/internal/generator/layout_tpl.go b/cmd/hz/generator/layout_tpl.go similarity index 100% rename from cmd/hz/internal/generator/layout_tpl.go rename to cmd/hz/generator/layout_tpl.go diff --git a/cmd/hz/internal/generator/model.go b/cmd/hz/generator/model.go similarity index 94% rename from cmd/hz/internal/generator/model.go rename to cmd/hz/generator/model.go index c84fb33..733c8a4 100644 --- a/cmd/hz/internal/generator/model.go +++ b/cmd/hz/generator/model.go @@ -22,10 +22,10 @@ import ( "strings" "text/template" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model/golang" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/generator/model/golang" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util" ) //---------------------------------Backend---------------------------------- diff --git a/cmd/hz/internal/generator/model/define.go b/cmd/hz/generator/model/define.go similarity index 100% rename from cmd/hz/internal/generator/model/define.go rename to cmd/hz/generator/model/define.go diff --git a/cmd/hz/internal/generator/model/expr.go b/cmd/hz/generator/model/expr.go similarity index 100% rename from cmd/hz/internal/generator/model/expr.go rename to cmd/hz/generator/model/expr.go diff --git a/cmd/hz/internal/generator/model/golang/constant.go b/cmd/hz/generator/model/golang/constant.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/constant.go rename to cmd/hz/generator/model/golang/constant.go diff --git a/cmd/hz/internal/generator/model/golang/enum.go b/cmd/hz/generator/model/golang/enum.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/enum.go rename to cmd/hz/generator/model/golang/enum.go diff --git a/cmd/hz/internal/generator/model/golang/file.go b/cmd/hz/generator/model/golang/file.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/file.go rename to cmd/hz/generator/model/golang/file.go diff --git a/cmd/hz/internal/generator/model/golang/function.go b/cmd/hz/generator/model/golang/function.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/function.go rename to cmd/hz/generator/model/golang/function.go diff --git a/cmd/hz/internal/generator/model/golang/init.go b/cmd/hz/generator/model/golang/init.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/init.go rename to cmd/hz/generator/model/golang/init.go diff --git a/cmd/hz/internal/generator/model/golang/oneof.go b/cmd/hz/generator/model/golang/oneof.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/oneof.go rename to cmd/hz/generator/model/golang/oneof.go diff --git a/cmd/hz/internal/generator/model/golang/struct.go b/cmd/hz/generator/model/golang/struct.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/struct.go rename to cmd/hz/generator/model/golang/struct.go diff --git a/cmd/hz/internal/generator/model/golang/typedef.go b/cmd/hz/generator/model/golang/typedef.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/typedef.go rename to cmd/hz/generator/model/golang/typedef.go diff --git a/cmd/hz/internal/generator/model/golang/variable.go b/cmd/hz/generator/model/golang/variable.go similarity index 100% rename from cmd/hz/internal/generator/model/golang/variable.go rename to cmd/hz/generator/model/golang/variable.go diff --git a/cmd/hz/internal/generator/model/model.go b/cmd/hz/generator/model/model.go similarity index 100% rename from cmd/hz/internal/generator/model/model.go rename to cmd/hz/generator/model/model.go diff --git a/cmd/hz/internal/generator/model_test.go b/cmd/hz/generator/model_test.go similarity index 97% rename from cmd/hz/internal/generator/model_test.go rename to cmd/hz/generator/model_test.go index f39ae23..9e11f52 100644 --- a/cmd/hz/internal/generator/model_test.go +++ b/cmd/hz/generator/model_test.go @@ -20,8 +20,8 @@ import ( "testing" "text/template" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/meta" ) type StringValue struct { diff --git a/cmd/hz/internal/generator/package.go b/cmd/hz/generator/package.go similarity index 96% rename from cmd/hz/internal/generator/package.go rename to cmd/hz/generator/package.go index 13249b5..6901e81 100644 --- a/cmd/hz/internal/generator/package.go +++ b/cmd/hz/generator/package.go @@ -24,9 +24,9 @@ import ( "reflect" "text/template" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util" "gopkg.in/yaml.v2" ) diff --git a/cmd/hz/internal/generator/package_tpl.go b/cmd/hz/generator/package_tpl.go similarity index 100% rename from cmd/hz/internal/generator/package_tpl.go rename to cmd/hz/generator/package_tpl.go diff --git a/cmd/hz/internal/generator/router.go b/cmd/hz/generator/router.go similarity index 99% rename from cmd/hz/internal/generator/router.go rename to cmd/hz/generator/router.go index 39b8a85..cebbe69 100644 --- a/cmd/hz/internal/generator/router.go +++ b/cmd/hz/generator/router.go @@ -25,7 +25,7 @@ import ( "sort" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/util" ) type Router struct { diff --git a/cmd/hz/internal/generator/template.go b/cmd/hz/generator/template.go similarity index 97% rename from cmd/hz/internal/generator/template.go rename to cmd/hz/generator/template.go index ed792cf..0b5ddc4 100644 --- a/cmd/hz/internal/generator/template.go +++ b/cmd/hz/generator/template.go @@ -25,9 +25,9 @@ import ( "strings" "text/template" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util" + "github.com/cloudwego/hertz/cmd/hz/util/logs" ) var DefaultDelimiters = [2]string{"{{", "}}"} diff --git a/cmd/hz/main.go b/cmd/hz/main.go index 1bd9f76..403fac3 100644 --- a/cmd/hz/main.go +++ b/cmd/hz/main.go @@ -18,20 +18,14 @@ package main import ( "os" - "path/filepath" - "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/app" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/protobuf" - "github.com/cloudwego/hertz/cmd/hz/internal/thrift" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/app" + "github.com/cloudwego/hertz/cmd/hz/util/logs" ) func main() { // run in plugin mode - pluginMode() + app.PluginMode() // run in normal mode Run() @@ -48,18 +42,3 @@ func Run() { logs.Errorf("%v\n", err) } } - -func pluginMode() { - pluginName := filepath.Base(os.Args[0]) - if util.IsWindows() { - pluginName = strings.TrimSuffix(pluginName, ".exe") - } - switch pluginName { - case meta.ThriftPluginName: - plugin := new(thrift.Plugin) - os.Exit(plugin.Run()) - case meta.ProtocPluginName: - plugin := new(protobuf.Plugin) - os.Exit(plugin.Run()) - } -} diff --git a/cmd/hz/internal/meta/const.go b/cmd/hz/meta/const.go similarity index 100% rename from cmd/hz/internal/meta/const.go rename to cmd/hz/meta/const.go diff --git a/cmd/hz/internal/meta/manifest.go b/cmd/hz/meta/manifest.go similarity index 97% rename from cmd/hz/internal/meta/manifest.go rename to cmd/hz/meta/manifest.go index 04ba2b3..9f465eb 100644 --- a/cmd/hz/internal/meta/manifest.go +++ b/cmd/hz/meta/manifest.go @@ -23,7 +23,7 @@ import ( "path/filepath" "regexp" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/util/logs" gv "github.com/hashicorp/go-version" ) diff --git a/cmd/hz/internal/meta/manifest_test.go b/cmd/hz/meta/manifest_test.go similarity index 100% rename from cmd/hz/internal/meta/manifest_test.go rename to cmd/hz/meta/manifest_test.go diff --git a/cmd/hz/internal/protobuf/api/api.pb.go b/cmd/hz/protobuf/api/api.pb.go similarity index 100% rename from cmd/hz/internal/protobuf/api/api.pb.go rename to cmd/hz/protobuf/api/api.pb.go diff --git a/cmd/hz/internal/protobuf/api/api.proto b/cmd/hz/protobuf/api/api.proto similarity index 100% rename from cmd/hz/internal/protobuf/api/api.proto rename to cmd/hz/protobuf/api/api.proto diff --git a/cmd/hz/internal/protobuf/ast.go b/cmd/hz/protobuf/ast.go similarity index 98% rename from cmd/hz/internal/protobuf/ast.go rename to cmd/hz/protobuf/ast.go index 9ca67c6..5ab85e9 100644 --- a/cmd/hz/internal/protobuf/ast.go +++ b/cmd/hz/protobuf/ast.go @@ -21,11 +21,11 @@ import ( "path/filepath" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/generator" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/protobuf/api" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/generator" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/protobuf/api" + "github.com/cloudwego/hertz/cmd/hz/util" + "github.com/cloudwego/hertz/cmd/hz/util/logs" "github.com/jhump/protoreflect/desc" "google.golang.org/protobuf/types/descriptorpb" ) diff --git a/cmd/hz/internal/protobuf/plugin.go b/cmd/hz/protobuf/plugin.go similarity index 98% rename from cmd/hz/internal/protobuf/plugin.go rename to cmd/hz/protobuf/plugin.go index b341164..7ae60fc 100644 --- a/cmd/hz/internal/protobuf/plugin.go +++ b/cmd/hz/protobuf/plugin.go @@ -54,12 +54,12 @@ import ( "path/filepath" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/config" - "github.com/cloudwego/hertz/cmd/hz/internal/generator" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/config" + "github.com/cloudwego/hertz/cmd/hz/generator" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util" + "github.com/cloudwego/hertz/cmd/hz/util/logs" gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/proto" diff --git a/cmd/hz/internal/protobuf/plugin_stubs.go b/cmd/hz/protobuf/plugin_stubs.go similarity index 100% rename from cmd/hz/internal/protobuf/plugin_stubs.go rename to cmd/hz/protobuf/plugin_stubs.go diff --git a/cmd/hz/internal/protobuf/plugin_test.go b/cmd/hz/protobuf/plugin_test.go similarity index 98% rename from cmd/hz/internal/protobuf/plugin_test.go rename to cmd/hz/protobuf/plugin_test.go index 39a38cf..b34d8b8 100644 --- a/cmd/hz/internal/protobuf/plugin_test.go +++ b/cmd/hz/protobuf/plugin_test.go @@ -21,7 +21,7 @@ import ( "strings" "testing" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" + "github.com/cloudwego/hertz/cmd/hz/meta" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/pluginpb" ) diff --git a/cmd/hz/internal/protobuf/resolver.go b/cmd/hz/protobuf/resolver.go similarity index 99% rename from cmd/hz/internal/protobuf/resolver.go rename to cmd/hz/protobuf/resolver.go index 4f428d5..8246b3c 100644 --- a/cmd/hz/internal/protobuf/resolver.go +++ b/cmd/hz/protobuf/resolver.go @@ -20,8 +20,8 @@ import ( "fmt" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/util" "github.com/jhump/protoreflect/desc" "google.golang.org/protobuf/types/descriptorpb" ) diff --git a/cmd/hz/internal/protobuf/tag_test.go b/cmd/hz/protobuf/tag_test.go similarity index 100% rename from cmd/hz/internal/protobuf/tag_test.go rename to cmd/hz/protobuf/tag_test.go diff --git a/cmd/hz/internal/protobuf/tags.go b/cmd/hz/protobuf/tags.go similarity index 97% rename from cmd/hz/internal/protobuf/tags.go rename to cmd/hz/protobuf/tags.go index 884b5b2..ac23668 100644 --- a/cmd/hz/internal/protobuf/tags.go +++ b/cmd/hz/protobuf/tags.go @@ -22,11 +22,11 @@ import ( "strconv" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/config" - "github.com/cloudwego/hertz/cmd/hz/internal/generator" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/protobuf/api" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/config" + "github.com/cloudwego/hertz/cmd/hz/generator" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/protobuf/api" + "github.com/cloudwego/hertz/cmd/hz/util" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/runtime/protoimpl" diff --git a/cmd/hz/internal/protobuf/test_data/protobuf_tag_test.out b/cmd/hz/protobuf/test_data/protobuf_tag_test.out similarity index 100% rename from cmd/hz/internal/protobuf/test_data/protobuf_tag_test.out rename to cmd/hz/protobuf/test_data/protobuf_tag_test.out diff --git a/cmd/hz/internal/protobuf/test_data/test_tag.proto b/cmd/hz/protobuf/test_data/test_tag.proto similarity index 100% rename from cmd/hz/internal/protobuf/test_data/test_tag.proto rename to cmd/hz/protobuf/test_data/test_tag.proto diff --git a/cmd/hz/internal/thrift/ast.go b/cmd/hz/thrift/ast.go similarity index 98% rename from cmd/hz/internal/thrift/ast.go rename to cmd/hz/thrift/ast.go index fb8632c..5bd6cfe 100644 --- a/cmd/hz/internal/thrift/ast.go +++ b/cmd/hz/thrift/ast.go @@ -19,10 +19,10 @@ package thrift import ( "fmt" - "github.com/cloudwego/hertz/cmd/hz/internal/generator" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/generator" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/util" + "github.com/cloudwego/hertz/cmd/hz/util/logs" "github.com/cloudwego/thriftgo/generator/golang/styles" "github.com/cloudwego/thriftgo/parser" ) diff --git a/cmd/hz/internal/thrift/name_style.go b/cmd/hz/thrift/name_style.go similarity index 100% rename from cmd/hz/internal/thrift/name_style.go rename to cmd/hz/thrift/name_style.go diff --git a/cmd/hz/internal/thrift/plugin.go b/cmd/hz/thrift/plugin.go similarity index 96% rename from cmd/hz/internal/thrift/plugin.go rename to cmd/hz/thrift/plugin.go index f4f599f..fa328d5 100644 --- a/cmd/hz/internal/thrift/plugin.go +++ b/cmd/hz/thrift/plugin.go @@ -23,12 +23,12 @@ import ( "path/filepath" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/config" - "github.com/cloudwego/hertz/cmd/hz/internal/generator" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/config" + "github.com/cloudwego/hertz/cmd/hz/generator" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util" + "github.com/cloudwego/hertz/cmd/hz/util/logs" "github.com/cloudwego/thriftgo/generator/golang/styles" thriftgo_plugin "github.com/cloudwego/thriftgo/plugin" ) diff --git a/cmd/hz/internal/thrift/plugin_test.go b/cmd/hz/thrift/plugin_test.go similarity index 93% rename from cmd/hz/internal/thrift/plugin_test.go rename to cmd/hz/thrift/plugin_test.go index 4593c6d..9d40bcd 100644 --- a/cmd/hz/internal/thrift/plugin_test.go +++ b/cmd/hz/thrift/plugin_test.go @@ -20,9 +20,9 @@ import ( "io/ioutil" "testing" - "github.com/cloudwego/hertz/cmd/hz/internal/generator" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/generator" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util" "github.com/cloudwego/thriftgo/plugin" ) diff --git a/cmd/hz/internal/thrift/resolver.go b/cmd/hz/thrift/resolver.go similarity index 99% rename from cmd/hz/internal/thrift/resolver.go rename to cmd/hz/thrift/resolver.go index 98d7724..bc8963a 100644 --- a/cmd/hz/internal/thrift/resolver.go +++ b/cmd/hz/thrift/resolver.go @@ -20,8 +20,8 @@ import ( "fmt" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/util" "github.com/cloudwego/thriftgo/parser" ) diff --git a/cmd/hz/internal/thrift/tag_test.go b/cmd/hz/thrift/tag_test.go similarity index 98% rename from cmd/hz/internal/thrift/tag_test.go rename to cmd/hz/thrift/tag_test.go index f9188e5..108dea8 100644 --- a/cmd/hz/internal/thrift/tag_test.go +++ b/cmd/hz/thrift/tag_test.go @@ -21,7 +21,7 @@ import ( "strings" "testing" - "github.com/cloudwego/hertz/cmd/hz/internal/config" + "github.com/cloudwego/hertz/cmd/hz/config" "github.com/cloudwego/thriftgo/plugin" ) diff --git a/cmd/hz/internal/thrift/tags.go b/cmd/hz/thrift/tags.go similarity index 97% rename from cmd/hz/internal/thrift/tags.go rename to cmd/hz/thrift/tags.go index 2e03c61..9b8c0cb 100644 --- a/cmd/hz/internal/thrift/tags.go +++ b/cmd/hz/thrift/tags.go @@ -22,10 +22,10 @@ import ( "strconv" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/config" - "github.com/cloudwego/hertz/cmd/hz/internal/generator" - "github.com/cloudwego/hertz/cmd/hz/internal/generator/model" - "github.com/cloudwego/hertz/cmd/hz/internal/util" + "github.com/cloudwego/hertz/cmd/hz/config" + "github.com/cloudwego/hertz/cmd/hz/generator" + "github.com/cloudwego/hertz/cmd/hz/generator/model" + "github.com/cloudwego/hertz/cmd/hz/util" "github.com/cloudwego/thriftgo/parser" ) diff --git a/cmd/hz/internal/thrift/test_data/test_tag.thrift b/cmd/hz/thrift/test_data/test_tag.thrift similarity index 100% rename from cmd/hz/internal/thrift/test_data/test_tag.thrift rename to cmd/hz/thrift/test_data/test_tag.thrift diff --git a/cmd/hz/internal/thrift/test_data/thrift_tag_test.out b/cmd/hz/thrift/test_data/thrift_tag_test.out similarity index 100% rename from cmd/hz/internal/thrift/test_data/thrift_tag_test.out rename to cmd/hz/thrift/test_data/thrift_tag_test.out diff --git a/cmd/hz/internal/util/ast.go b/cmd/hz/util/ast.go similarity index 100% rename from cmd/hz/internal/util/ast.go rename to cmd/hz/util/ast.go diff --git a/cmd/hz/internal/util/ast_test.go b/cmd/hz/util/ast_test.go similarity index 100% rename from cmd/hz/internal/util/ast_test.go rename to cmd/hz/util/ast_test.go diff --git a/cmd/hz/internal/util/data.go b/cmd/hz/util/data.go similarity index 99% rename from cmd/hz/internal/util/data.go rename to cmd/hz/util/data.go index 3622a5b..8f75f17 100644 --- a/cmd/hz/internal/util/data.go +++ b/cmd/hz/util/data.go @@ -25,7 +25,7 @@ import ( "strconv" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/util/logs" ) func CopyStringSlice(from, to *[]string) { diff --git a/cmd/hz/internal/util/data_test.go b/cmd/hz/util/data_test.go similarity index 100% rename from cmd/hz/internal/util/data_test.go rename to cmd/hz/util/data_test.go diff --git a/cmd/hz/internal/util/env.go b/cmd/hz/util/env.go similarity index 98% rename from cmd/hz/internal/util/env.go rename to cmd/hz/util/env.go index a6ae0a7..51168e2 100644 --- a/cmd/hz/internal/util/env.go +++ b/cmd/hz/util/env.go @@ -27,7 +27,7 @@ import ( "regexp" "strings" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" + "github.com/cloudwego/hertz/cmd/hz/meta" ) func GetGOPATH() (gopath string, err error) { diff --git a/cmd/hz/internal/util/fs.go b/cmd/hz/util/fs.go similarity index 100% rename from cmd/hz/internal/util/fs.go rename to cmd/hz/util/fs.go diff --git a/cmd/hz/internal/util/logs/api.go b/cmd/hz/util/logs/api.go similarity index 100% rename from cmd/hz/internal/util/logs/api.go rename to cmd/hz/util/logs/api.go diff --git a/cmd/hz/internal/util/logs/std.go b/cmd/hz/util/logs/std.go similarity index 100% rename from cmd/hz/internal/util/logs/std.go rename to cmd/hz/util/logs/std.go diff --git a/cmd/hz/internal/util/string.go b/cmd/hz/util/string.go similarity index 100% rename from cmd/hz/internal/util/string.go rename to cmd/hz/util/string.go diff --git a/cmd/hz/internal/util/tool_install.go b/cmd/hz/util/tool_install.go similarity index 97% rename from cmd/hz/internal/util/tool_install.go rename to cmd/hz/util/tool_install.go index 46a004e..1081d4f 100644 --- a/cmd/hz/internal/util/tool_install.go +++ b/cmd/hz/util/tool_install.go @@ -24,8 +24,8 @@ import ( "strings" "time" - "github.com/cloudwego/hertz/cmd/hz/internal/meta" - "github.com/cloudwego/hertz/cmd/hz/internal/util/logs" + "github.com/cloudwego/hertz/cmd/hz/meta" + "github.com/cloudwego/hertz/cmd/hz/util/logs" gv "github.com/hashicorp/go-version" ) diff --git a/cmd/hz/internal/util/tool_install_test.go b/cmd/hz/util/tool_install_test.go similarity index 100% rename from cmd/hz/internal/util/tool_install_test.go rename to cmd/hz/util/tool_install_test.go