Przeglądaj źródła

add standalone test program for detect.

also, fix detect itself (relative references are ... bad?)
Lucas Stadler 11 lat temu
rodzic
commit
d30792314d
3 zmienionych plików z 24 dodań i 3 usunięć
  1. 1 0
      go/.gitignore
  2. 1 3
      go/detect/detect.go
  3. 22 0
      go/test_detect.go

+ 1 - 0
go/.gitignore

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

+ 1 - 3
go/detect/detect.go

@ -1,11 +1,9 @@
1 1
package detect
2 2
3 3
import (
4
	"fmt"
5
	"os"
6 4
	"path"
7 5
8
	"./fileutil"
6
	"../fileutil"
9 7
)
10 8
11 9
/*

+ 22 - 0
go/test_detect.go

@ -0,0 +1,22 @@
1
package main
2
3
import (
4
	"fmt"
5
	"os"
6
7
	"./detect"
8
)
9
10
func main() {
11
	if len(os.Args) < 2 {
12
		fmt.Printf("Usage: %s <file>\n", os.Args[0])
13
		os.Exit(1)
14
	}
15
16
	file := os.Args[1]
17
18
	for _, project := range detect.ProjectTypes {
19
		runCmd := project.Commands["run"]
20
		fmt.Printf("%v (%v): %v\n", project.Id, runCmd, project.Detect(file))
21
	}
22
}