diff --git a/internal/code-generator/assets/type.go.tmpl b/internal/code-generator/assets/type.go.tmpl index bf063a2..94dbdfa 100644 --- a/internal/code-generator/assets/type.go.tmpl +++ b/internal/code-generator/assets/type.go.tmpl @@ -4,20 +4,22 @@ package slinguist // THIS FILE SHOULD NOT BE EDITED BY HAND // Extracted from github/linguist commit: {{ getCommit }} +type Type int + const ( - TypeUnknown = iota + TypeUnknown Type = iota TypeData TypeProgramming TypeMarkup TypeProse ) -func GetLanguageType(language string) (langType int) { +func GetLanguageType(language string) (langType Type) { langType, _ = languagesType[language] return langType } -var languagesType = map[string]int{ +var languagesType = map[string]Type{ {{range $language, $type := . -}} "{{ $language }}": {{ $type -}}, {{end -}} diff --git a/internal/code-generator/generator/test_files/formated_type.gold b/internal/code-generator/generator/test_files/formated_type.gold index 8ce97d1..69eec08 100644 --- a/internal/code-generator/generator/test_files/formated_type.gold +++ b/internal/code-generator/generator/test_files/formated_type.gold @@ -4,20 +4,22 @@ package slinguist // THIS FILE SHOULD NOT BE EDITED BY HAND // Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7 +type Type int + const ( - TypeUnknown = iota + TypeUnknown Type = iota TypeData TypeProgramming TypeMarkup TypeProse ) -func GetLanguageType(language string) (langType int) { +func GetLanguageType(language string) (langType Type) { langType, _ = languagesType[language] return langType } -var languagesType = map[string]int{ +var languagesType = map[string]Type{ "Scaml": TypeMarkup, "Scheme": TypeProgramming, "Scilab": TypeProgramming, diff --git a/internal/code-generator/generator/test_files/type.gold b/internal/code-generator/generator/test_files/type.gold index a128e6c..a00b93c 100644 --- a/internal/code-generator/generator/test_files/type.gold +++ b/internal/code-generator/generator/test_files/type.gold @@ -4,20 +4,22 @@ package slinguist // THIS FILE SHOULD NOT BE EDITED BY HAND // Extracted from github/linguist commit: fe8b44ab8a225b1ffa75b983b916ea22fee5b6f7 +type Type int + const ( - TypeUnknown = iota + TypeUnknown Type = iota TypeData TypeProgramming TypeMarkup TypeProse ) -func GetLanguageType(language string) (langType int) { +func GetLanguageType(language string) (langType Type) { langType, _ = languagesType[language] return langType } -var languagesType = map[string]int{ +var languagesType = map[string]Type{ "Scaml": TypeMarkup, "Scheme": TypeProgramming, "Scilab": TypeProgramming, diff --git a/internal/code-generator/generator/test_files/type.test.go.tmpl b/internal/code-generator/generator/test_files/type.test.go.tmpl index bf063a2..94dbdfa 100644 --- a/internal/code-generator/generator/test_files/type.test.go.tmpl +++ b/internal/code-generator/generator/test_files/type.test.go.tmpl @@ -4,20 +4,22 @@ package slinguist // THIS FILE SHOULD NOT BE EDITED BY HAND // Extracted from github/linguist commit: {{ getCommit }} +type Type int + const ( - TypeUnknown = iota + TypeUnknown Type = iota TypeData TypeProgramming TypeMarkup TypeProse ) -func GetLanguageType(language string) (langType int) { +func GetLanguageType(language string) (langType Type) { langType, _ = languagesType[language] return langType } -var languagesType = map[string]int{ +var languagesType = map[string]Type{ {{range $language, $type := . -}} "{{ $language }}": {{ $type -}}, {{end -}} diff --git a/type.go b/type.go index 32058e4..00b4b93 100644 --- a/type.go +++ b/type.go @@ -4,20 +4,22 @@ package slinguist // THIS FILE SHOULD NOT BE EDITED BY HAND // Extracted from github/linguist commit: dae33dc2b20cddc85d1300435c3be7118a7115a9 +type Type int + const ( - TypeUnknown = iota + TypeUnknown Type = iota TypeData TypeProgramming TypeMarkup TypeProse ) -func GetLanguageType(language string) (langType int) { +func GetLanguageType(language string) (langType Type) { langType, _ = languagesType[language] return langType } -var languagesType = map[string]int{ +var languagesType = map[string]Type{ "1C Enterprise": TypeProgramming, "ABAP": TypeProgramming, "ABNF": TypeData,