Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ExtensionToLanguage = map[string]string{
"go": "Go",
"js": "JavaScript", "jsx": "JavaScript", "mjs": "JavaScript", "cjs": "JavaScript",
"ts": "TypeScript", "tsx": "TypeScript", "mts": "TypeScript", "cts": "TypeScript",
"py": "Python", "pyi": "Python", "pyw": "Python",
"rs": "Rust",
"java": "Java", "kt": "Kotlin", "kts": "Kotlin",
"c": "C", "h": "C",
"cpp": "C++", "cc": "C++", "cxx": "C++", "hpp": "C++", "hxx": "C++",
"cs": "C#", "csx": "C#",
"swift": "Swift",
"dart": "Dart",
"rb": "Ruby", "erb": "Ruby",
"php": "PHP",
"sh": "Shell", "bash": "Shell", "zsh": "Shell", "fish": "Shell",
"ps1": "PowerShell", "psm1": "PowerShell", "psd1": "PowerShell",
"html": "HTML", "htm": "HTML",
"css": "CSS", "scss": "SCSS", "sass": "Sass", "less": "Less",
"json": "JSON", "jsonc": "JSON",
"yaml": "YAML", "yml": "YAML",
"toml": "TOML",
"xml": "XML", "xsl": "XML", "xslt": "XML",
"ini": "INI",
"env": "Env",
"properties": "Properties",
"md": "Markdown", "mdx": "Markdown",
"rst": "reStructuredText",
"tex": "LaTeX",
"sql": "SQL",
"graphql": "GraphQL", "gql": "GraphQL",
"proto": "Protobuf",
"dockerfile": "Dockerfile",
"tf": "Terraform", "tfvars": "Terraform",
"lua": "Lua",
"r": "R", "rmd": "R",
"scala": "Scala",
"ex": "Elixir", "exs": "Elixir",
"erl": "Erlang", "hrl": "Erlang",
"hs": "Haskell",
"zig": "Zig",
"vue": "Vue", "svelte": "Svelte",
"txt": "Text",
"csv": "CSV",
"svg": "SVG",
"bat": "Batch", "cmd": "Batch",
"makefile": "Makefile",
"cmake": "CMake",
"gradle": "Gradle",
}
ExtensionToLanguage maps file extensions (without dot) to language names.
Functions ¶
func DetectLanguage ¶
DetectLanguage returns the programming language for a file path based on its extension. Returns "Unknown" if the extension is not recognized.
func IsBinaryContent ¶
IsBinaryContent checks if the given byte slice appears to be binary content. It checks the first 512 bytes (or less) for null bytes, which indicates binary data.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.