-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgo.go
40 lines (31 loc) · 801 Bytes
/
go.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package lang
import (
"github.com/safedep/code/core"
sitter "github.com/smacker/go-tree-sitter"
"github.com/smacker/go-tree-sitter/golang"
)
const goLanguageName = "go"
type goLanguage struct{}
var _ core.Language = (*goLanguage)(nil)
func NewGoLanguage() (*goLanguage, error) {
return &goLanguage{}, nil
}
func (l *goLanguage) Name() string {
return goLanguageName
}
func (l *goLanguage) Meta() core.LanguageMeta {
return core.LanguageMeta{
Name: goLanguageName,
Code: core.LanguageCodeGo,
ObjectOriented: false,
SourceFileExtensions: []string{".go"},
}
}
func (l *goLanguage) Language() *sitter.Language {
return golang.GetLanguage()
}
func (l *goLanguage) Resolvers() core.LanguageResolvers {
return &goResolvers{
language: l,
}
}