chore: when run goctl-rpc, the order of proto message aliases should be (#1078)

fixed

Co-authored-by: steven <steven.zhou@1quant.com>
master
shenbaise9527 3 years ago committed by GitHub
parent 004ee488a6
commit f34d81ca2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@ package generator
import (
"fmt"
"path/filepath"
"sort"
"strings"
"github.com/emicklei/proto"
@ -95,9 +96,11 @@ func (g *DefaultGenerator) GenCall(ctx DirContext, proto parser.Proto, cfg *conf
alias.AddStr(fmt.Sprintf("%s = %s", parser.CamelCase(msgName), fmt.Sprintf("%s.%s", proto.PbPackage, parser.CamelCase(msgName))))
}
aliasKeys := alias.KeysStr()
sort.Strings(aliasKeys)
err = util.With("shared").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
"name": callFilename,
"alias": strings.Join(alias.KeysStr(), util.NL),
"alias": strings.Join(aliasKeys, util.NL),
"head": head,
"filePackage": dir.Base,
"package": fmt.Sprintf(`"%s"`, ctx.GetPb().Package),

Loading…
Cancel
Save