func ExampleMustParse() { memorySize := resource.MustParse("5Gi") fmt.Printf("memorySize = %v (%v)\n", memorySize.Value(), memorySize.Format) diskSize := resource.MustParse("5G") fmt.Printf("diskSize = %v (%v)\n", diskSize.Value(), diskSize.Format) cores := resource.MustParse("5300m") fmt.Printf("milliCores = %v (%v)\n", cores.MilliValue(), cores.Format) cores2 := resource.MustParse("5.4") fmt.Printf("milliCores = %v (%v)\n", cores2.MilliValue(), cores2.Format) // Output: // memorySize = 5368709120 (BinarySI) // diskSize = 5000000000 (DecimalSI) // milliCores = 5300 (DecimalSI) // milliCores = 5400 (DecimalSI) }
func mustQuantity(s string) *resource.Quantity { q := resource.MustParse(s) return &q }