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

Function classifyBuild

internal/cmdutil/secheader.go:141–160  ·  view source on GitHub ↗

classifyBuild is the pure classification logic used by computeBuildKind. Callers supply concrete values so every branch is reachable from tests without touching debug.ReadBuildInfo or the extension registries. Priority order mirrors the design doc: 1. no build info → unknown 2. main module path not

(mainPath string, haveBuildInfo bool, credProviders []any, transportProvider, fileioProvider any)

Source from the content-addressed store, hash-verified

139// 3. any non-builtin provider (credential / transport / fileio) → extended
140// 4. otherwise → official
141func classifyBuild(mainPath string, haveBuildInfo bool, credProviders []any, transportProvider, fileioProvider any) string {
142 if !haveBuildInfo {
143 return BuildKindUnknown
144 }
145 if mainPath != "" && mainPath != officialModulePath {
146 return BuildKindExtended
147 }
148 for _, p := range credProviders {
149 if !isBuiltinProvider(p) {
150 return BuildKindExtended
151 }
152 }
153 if transportProvider != nil && !isBuiltinProvider(transportProvider) {
154 return BuildKindExtended
155 }
156 if fileioProvider != nil && !isBuiltinProvider(fileioProvider) {
157 return BuildKindExtended
158 }
159 return BuildKindOfficial
160}
161
162// isBuiltinProvider reports whether p is declared under the official module
163// path. Third-party providers live under their own module and fail this check.

Calls 1

isBuiltinProviderFunction · 0.85