import ( "fmt" "github.com/docker/docker/pkg/version" ) func main() { v1 := "1.13.0" v2 := "1.12.0" result := version.Compare(v1, v2) if result == 1 { fmt.Printf("%s is newer than %s\n", v1, v2) } else if result == -1 { fmt.Printf("%s is older than %s\n", v1, v2) } else { fmt.Printf("%s and %s are the same version\n", v1, v2) } }
import ( "fmt" "github.com/docker/docker/pkg/version" ) func main() { v, err := version.Get() if err != nil { fmt.Println("Error getting version information:", err) return } fmt.Printf("Docker version: %s\n", v.Version) fmt.Printf("API version: %s\n", v.ApiVersion) }Both of these examples use functions from the `github.com/docker/docker/pkg/version` package, which indicates that this package is likely part of the Docker source code and not a standalone library.