DetectBuildKind reports whether this binary is the official CLI, an extended/repackaged build, or unknown. The result is cached via sync.Once so it is computed only on the first call. IMPORTANT: must NOT be called from any package init(). Go's init ordering follows the import graph; ISV providers r
()
| 95 | // have run yet, which would misclassify an extended build as official. Call |
| 96 | // only when handling an actual request (e.g. from BaseSecurityHeaders). |
| 97 | func DetectBuildKind() string { |
| 98 | buildKindOnce.Do(func() { |
| 99 | buildKindVal = computeBuildKind() |
| 100 | }) |
| 101 | return buildKindVal |
| 102 | } |
| 103 | |
| 104 | // computeBuildKind performs the actual detection without any caching. |
| 105 | // Exposed for tests. Gathers runtime/global inputs and delegates the pure |