func SetVersion()

in main.go [102:122]


func SetVersion() {
	if os.Getenv("GITLAB_VERSION") != "" {
		version = "GitLab " + os.Getenv("GITLAB_VERSION")
	} else if os.Getenv("CI_SERVER_VERSION") != "" {
		version = "GitLab test server " + os.Getenv("CI_SERVER_VERSION")
	}

	if version == "" {
		// If GITLAB_VERSION is still blank, try to read from rails root.
		// This will work only if collector is inside gitlab-development-kit dir.
		contents, _ := ioutil.ReadFile("../gitlab/VERSION")

		if len(contents) > 0 {
			version = "GitLab " + strings.TrimSuffix(string(contents), "\n")
		} else {
			panic("No GitLab version file found.")
		}
	}

	fmt.Println("Running the Product Analytics Collector.", version)
}