Explorar el Código

make detect a package.

Lucas Stadler %!s(int64=11) %!d(string=hace) años
padre
commit
bffe573bb3
Se han modificado 2 ficheros con 1 adiciones y 16 borrados
  1. 0 1
      go/.gitignore
  2. 1 15
      go/detect.go

+ 0 - 1
go/.gitignore

@ -1,6 +1,5 @@
1 1
.go
2 2
3
detect
4 3
qst
5 4
6 5
examples/hello

+ 1 - 15
go/detect.go

@ -1,4 +1,4 @@
1
package main
1
package detect
2 2
3 3
import (
4 4
	"fmt"
@ -40,20 +40,6 @@ var ProjectTypes = []Project{
40 40
	Project{"ruby/default", Commands{"run": "ruby {file}"}, rubyDefault},
41 41
}
42 42
43
func main() {
44
	if len(os.Args) < 2 {
45
		fmt.Printf("Usage: %s <file>\n", os.Args[0])
46
		os.Exit(1)
47
	}
48
49
	file := os.Args[1]
50
51
	for _, project := range ProjectTypes {
52
		runCmd := project.Commands["run"]
53
		fmt.Printf("%v (%v): %v\n", project.Id, runCmd, project.Detect(file))
54
	}
55
}
56
57 43
func matchingFileOrDir(file string, pattern string) bool {
58 44
	if fileutil.IsFile(file) {
59 45
		_, f := path.Split(file)