import ( "fmt" "github.com/dotcloud/docker/pkg/version" ) func main() { dockerVersion := version.Version() fmt.Printf("Docker version: %s\n", dockerVersion) }
import ( "fmt" "github.com/dotcloud/docker/pkg/version" ) func main() { ver1 := version.VersionCompare("1.13.0", "1.12.0") ver2 := version.VersionCompare("1.13.0", "1.14.0") fmt.Printf("Version comparison results: ver1=%d, ver2=%d\n", ver1, ver2) }Description: This code example demonstrates the use of `version.VersionCompare()` function to compare two different versions of Docker. The function returns an integer value indicating the comparison result. Any negative value indicates that the first version is less than the second version, 0 indicates they are equal, and any positive value indicates the first version is greater than the second version.