feat: add golang's top-level keywords to golang's stop words. (#554)

dedup-snippet-at-index
Meng Zhang 2023-10-14 00:42:26 -07:00 committed by GitHub
parent d22f51cc16
commit 9dc5acb62e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -69,6 +69,24 @@ lazy_static! {
stop_words: &JAVASCRIPT_TYPESCRIPT_STOP_WORDS,
line_comment: "//",
};
/* Golang */
static ref GO_STOP_WORDS: Vec<&'static str> = vec![
"\n//",
"\nfunc",
"\ninterface",
"\nstruct",
"\npackage",
"\ntype",
"\nimport",
"\nvar",
"\nconst",
]
.with_default();
static ref GO: Language = Language {
stop_words: &GO_STOP_WORDS,
line_comment: "//",
};
}
pub fn get_language(language: &str) -> &'static Language {
@ -78,6 +96,8 @@ pub fn get_language(language: &str) -> &'static Language {
&RUST
} else if language == "javascript" || language == "typescript" {
&JAVASCRIPT_TYPESCRIPT
} else if language == "go" {
&GO
} else {
&UNKONWN
}