github.com/xzntrc/go-enry/v2@v2.0.0-20230215091818-766cc1d65498/enry.go (about) 1 /* 2 Package enry implements multiple strategies for programming language identification. 3 4 Identification is made based on file name and file content using a service 5 of strategies to narrow down possible option. 6 Each strategy is available as a separate API call, as well as a main enty point 7 8 GetLanguage(filename string, content []byte) (language string) 9 10 It is a port of the https://github.com/github/linguist from Ruby. 11 Upstream Linguist YAML files are used to generate datastructures for data 12 package. 13 */ 14 package enry // import "github.com/go-enry/go-enry/v2" 15 16 //go:generate make code-generate 17 18 import "github.com/go-enry/go-enry/v2/data" 19 20 // Type represent language's type. Either data, programming, markup, prose, or unknown. 21 type Type int 22 23 // Type's values. 24 const ( 25 Unknown Type = Type(data.TypeUnknown) 26 Data = Type(data.TypeData) 27 Programming = Type(data.TypeProgramming) 28 Markup = Type(data.TypeMarkup) 29 Prose = Type(data.TypeProse) 30 )