Skip to content

Commit

Permalink
Merge pull request #12485 from coreydaley/github_12417_go_detector
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Jan 14, 2017
2 parents 13074d4 + 77b08ef commit e696f47
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/gitserver/hooks/detect-language
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,9 @@ if has project.json || hasglob '*.csproj'; then
exit 0
fi

if has main.go Godeps; then
echo "${prefix}golang"
exit 0
fi

exit 1
6 changes: 6 additions & 0 deletions pkg/generate/source/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var DefaultDetectors = Detectors{
DetectScala,
DetectDotNet,
DetectLiteralDotNet,
DetectGolang,
}

// DetectRuby detects Ruby source
Expand Down Expand Up @@ -74,6 +75,11 @@ func DetectLiteralDotNet(dir string) *Info {
return detect(".net", dir, "project.json", "*.csproj")
}

// DetectGolang detects Go source
func DetectGolang(dir string) *Info {
return detect("golang", dir, "main.go", "Godeps")
}

// detect returns an Info object with the given platform if the source at dir contains any of the argument files
func detect(platform string, dir string, globs ...string) *Info {
for _, g := range globs {
Expand Down

0 comments on commit e696f47

Please sign in to comment.