Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 5726ec1

Browse files
authored
Merge pull request #9 from github/autobuilder-add-print
autobuilder: Add line printing the environment and build versions of Go
2 parents d14eb85 + 7c45316 commit 5726ec1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

extractor/cli/go-autobuilder/go-autobuilder.go

+10
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ variable.
3636
fmt.Fprintf(os.Stderr, "Usage:\n\n %s\n", os.Args[0])
3737
}
3838

39+
func getEnvGoVersion() string {
40+
gover, err := exec.Command("go", "version").CombinedOutput()
41+
if err != nil {
42+
log.Fatalf("Unable to run the go command, is it installed?\nError: %s", err.Error())
43+
}
44+
return strings.Fields(string(gover))[2]
45+
}
46+
3947
func fileExists(filename string) bool {
4048
_, err := os.Stat(filename)
4149
if err != nil && !os.IsNotExist(err) {
@@ -97,6 +105,8 @@ func main() {
97105
os.Exit(2)
98106
}
99107

108+
log.Printf("Autobuilder was built with %s, environment has %s\n", runtime.Version(), getEnvGoVersion())
109+
100110
srcdir := os.Getenv("LGTM_SRC")
101111
inLGTM := srcdir != ""
102112
if inLGTM {

0 commit comments

Comments
 (0)