Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateFullHash ¶
CalculateFullHash returns full 64-character SHA256 hash. Use this for database storage if full hash precision is needed.
func CalculateHash ¶
CalculateHash computes SHA256 hash of documentation file with line ending normalization. Returns first 16 characters (64 bits) for abbreviated display in CANARY tokens.
Line endings are normalized to LF (\n) before hashing to ensure cross-platform consistency between Windows (CRLF) and Unix/Mac (LF) systems.
Example:
hash, err := docs.CalculateHash("docs/user/auth.md")
// Returns: "8f434346648f6b96" (first 16 chars of SHA256)
func CheckMultipleDocumentation ¶
CheckMultipleDocumentation handles tokens with multiple DOC paths (comma-separated). Returns a map of doc path to status for each documentation file.
Example:
// Token with: DOC=user:docs/user.md,api:docs/api.md
results, err := docs.CheckMultipleDocumentation(token)
// Returns: {"docs/user.md": "DOC_CURRENT", "docs/api.md": "DOC_STALE"}
func CheckStaleness ¶
CheckStaleness compares documentation file hash to token DOC_HASH field. Returns one of: DOC_CURRENT, DOC_STALE, DOC_MISSING, or DOC_UNHASHED
Status meanings:
- DOC_CURRENT: File hash matches token DOC_HASH (documentation is up-to-date)
- DOC_STALE: File hash differs from token DOC_HASH (documentation needs updating)
- DOC_MISSING: Documentation file does not exist at specified path
- DOC_UNHASHED: Token has no DOC_HASH field (hash tracking not enabled)
Example:
status, err := docs.CheckStaleness(token)
if status == "DOC_STALE" {
fmt.Printf("Documentation for %s is outdated\n", token.ReqID)
}
Types ¶
This section is empty.