Skip to content

Commit 3c388e6

Browse files
committed
feat(gen): fix gensdk scope client sort
1 parent 5d58a7f commit 3c388e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/gen/gensdk/generator/golang.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
goformat "go/format"
77
"os"
88
"path/filepath"
9+
"sort"
910
"strings"
1011

1112
"github.com/jhump/protoreflect/desc"
@@ -196,7 +197,10 @@ func (g *Golang) Gen() ([]*GeneratedFile, error) {
196197
files = append(files, directClientFiles...)
197198

198199
for _, scope := range getScopes(rhis) {
199-
scopeClientFiles, err := g.genScopeClients(scope, getScopeResources(rhis[vars.Scope(scope)]))
200+
// 对 resource 进行排序
201+
resources := getScopeResources(rhis[vars.Scope(scope)])
202+
sort.Strings(resources)
203+
scopeClientFiles, err := g.genScopeClients(scope, resources)
200204
if err != nil {
201205
return nil, err
202206
}

0 commit comments

Comments
 (0)