MCPcopy
hub / github.com/larksuite/cli / computeBuildKind

Function computeBuildKind

internal/cmdutil/secheader.go:108–130  ·  view source on GitHub ↗

computeBuildKind performs the actual detection without any caching. Exposed for tests. Gathers runtime/global inputs and delegates the pure branching logic to classifyBuild so that logic can be unit-tested without mutating process-wide provider registries.

()

Source from the content-addressed store, hash-verified

106// branching logic to classifyBuild so that logic can be unit-tested without
107// mutating process-wide provider registries.
108func computeBuildKind() string {
109 info, ok := debug.ReadBuildInfo()
110 mainPath := ""
111 if ok {
112 mainPath = info.Main.Path
113 }
114
115 credProviders := credential.Providers()
116 creds := make([]any, len(credProviders))
117 for i, p := range credProviders {
118 creds[i] = p
119 }
120
121 var tp any
122 if p := exttransport.GetProvider(); p != nil {
123 tp = p
124 }
125 var fp any
126 if p := fileio.GetProvider(); p != nil {
127 fp = p
128 }
129 return classifyBuild(mainPath, ok, creds, tp, fp)
130}
131
132// classifyBuild is the pure classification logic used by computeBuildKind.
133// Callers supply concrete values so every branch is reachable from tests

Callers 2

DetectBuildKindFunction · 0.85

Calls 3

ProvidersFunction · 0.92
GetProviderFunction · 0.92
classifyBuildFunction · 0.85

Tested by 1