Skip to content

Commit

Permalink
chore: upgrade google protobuf
Browse files Browse the repository at this point in the history
Signed-off-by: rogerogers <rogers@rogerogers.com>
  • Loading branch information
rogerogers committed Mar 12, 2024
1 parent ac50c34 commit 064d0d2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/static/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Examples:
`

ApiListName = "api-list"
ApiUsage = `analyze router codes by golang asy
ApiUsage = `analyze router codes by golang ast
Examples:
cwgo api --project_path ./
Expand Down
1 change: 1 addition & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func Client(c *config.ClientArgument) error {
os.Exit(1)
}
utils.ReplaceThriftVersion()
utils.UpgradeGolangProtobuf()
utils.Hessian2PostProcessing(args)
case consts.HTTP:
args := hzConfig.NewArgument()
Expand Down
17 changes: 14 additions & 3 deletions pkg/common/utils/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,27 @@ func IsWindows() bool {
return consts.SysType == consts.WindowsOS
}

func ReplaceThriftVersion() {
cmd := "go mod edit -replace github.com/apache/thrift=github.com/apache/thrift@v0.13.0"
func commandAndNotice(cmd, notice string) {
argv := strings.Split(cmd, consts.BlackSpace)
err := exec.Command(argv[0], argv[1:]...).Run()

res := "Done"
if err != nil {
res = err.Error()
}
logs.Warn("Adding apache/thrift@v0.13.0 to go.mod for generated code ..........", res)
logs.Warn(notice, res)
}

func ReplaceThriftVersion() {
cmd := "go mod edit -replace github.com/apache/thrift=github.com/apache/thrift@v0.13.0"
notice := "Adding apache/thrift@v0.13.0 to go.mod for generated code .........."
commandAndNotice(cmd, notice)
}

func UpgradeGolangProtobuf() {
cmd := "go get github.com/golang/protobuf"
notice := "Upgrading github.com/golang/protobuf to 1.5.4 ........."
commandAndNotice(cmd, notice)
}

// Hessian2PostProcessing is responsible for performing hessian2-related post-processing.
Expand Down
1 change: 1 addition & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func Server(c *config.ServerArgument) error {
}
}
utils.ReplaceThriftVersion()
utils.UpgradeGolangProtobuf()
utils.Hessian2PostProcessing(args)
case consts.HTTP:
args := hzConfig.NewArgument()
Expand Down

0 comments on commit 064d0d2

Please sign in to comment.