replicatedhq/troubleshoot

Version information missing from troubleshoot if the project is used as a dependency

banjoh opened this issue · 0 comments

banjoh commented

Bug Description

version.Version() will return an empty string if troubleshoot is used as a dependency. KOTS for example used troubleshoot as a dependency leading to generating support bundles that have incomplete version.yaml files.

Expected Behavior

Calling version.Version() should always return the version of troubleshoot in use by the binary being executed.

Steps To Reproduce

  • Create a go project with the following commands
mkdir tmpdir && cd tmpdir
go mod init someproject
  • Add troubleshoot as a dependency
go get github.com/replicatedhq/troubleshoot
  • Drop the code below into your main.go
package main

import (
	"fmt"

	"github.com/replicatedhq/troubleshoot/pkg/version"
)

func main() {
	fmt.Printf("Troubleshoot version: %q\n", version.Version())
}
  • Run the application and expect the following output
[evans] $ go run main.go
Troubleshoot version: ""