Add self-contained gometalinter build tooling.

This commit is contained in:
Will Rouesnel
2017-06-06 21:39:41 +10:00
parent 0de0311c22
commit e2b6c973a1
710 changed files with 277204 additions and 35 deletions

22
tools/vendor/github.com/mibk/dupl/job/buildtree.go generated vendored Normal file
View File

@@ -0,0 +1,22 @@
package job
import (
"github.com/mibk/dupl/suffixtree"
"github.com/mibk/dupl/syntax"
)
func BuildTree(schan chan []*syntax.Node) (t *suffixtree.STree, d *[]*syntax.Node, done chan bool) {
t = suffixtree.New()
data := make([]*syntax.Node, 0, 100)
done = make(chan bool)
go func() {
for seq := range schan {
data = append(data, seq...)
for _, node := range seq {
t.Update(node)
}
}
done <- true
}()
return t, &data, done
}

36
tools/vendor/github.com/mibk/dupl/job/parse.go generated vendored Normal file
View File

@@ -0,0 +1,36 @@
package job
import (
"log"
"github.com/mibk/dupl/syntax"
"github.com/mibk/dupl/syntax/golang"
)
func Parse(fchan chan string) chan []*syntax.Node {
// parse AST
achan := make(chan *syntax.Node)
go func() {
for file := range fchan {
ast, err := golang.Parse(file)
if err != nil {
log.Println(err)
continue
}
achan <- ast
}
close(achan)
}()
// serialize
schan := make(chan []*syntax.Node)
go func() {
for ast := range achan {
seq := syntax.Serialize(ast)
schan <- seq
}
close(schan)
}()
return schan
}