github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/internal/testhelpers/installation/fakeversioncmd/main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/ActiveState/cli/internal/constants"
     7  )
     8  
     9  // This command is used in our test-updates as the State Tool executable.
    10  // It simply returns a faked version and channel name on every invocation, so
    11  // we can ensure that the installation/update was indeed successful.
    12  
    13  var version string = "99.99.9999"
    14  var channel string // can be set through linker flag -ldflags "-X main.channel=test-channel"
    15  
    16  func main() {
    17  	if channel == "" {
    18  		channel = constants.ChannelName
    19  	}
    20  	fmt.Printf(`{"version": "%s", "channel": "%s"}`, version, channel)
    21  }