lang

package
v3.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package lang provides language detection from file extensions.

Detection here is purely extension-based and requires no framework description — it is the entry point for discover's framework-agnostic path, which needs to know what a file *is* before any route/framework knowledge is available.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Language

type Language string

Language identifies a source language recognized by discover.

const (
	Go         Language = "go"
	Ruby       Language = "ruby"
	Python     Language = "python"
	JavaScript Language = "javascript"
)

Languages with a tree-sitter grammar wired up in pkg/discover/treesitter.

func Detect

func Detect(path string) (Language, bool)

Detect returns the language signaled by path's extension and whether one was recognized. path is not read from disk; only its extension is used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL