[mem][solaris] simplify regular expressions

pull/1161/head
Ville Skyttä 4 years ago
parent 093e68cb91
commit 09c3ba3896

@ -67,7 +67,7 @@ func zoneName() (string, error) {
return strings.TrimSpace(string(out)), nil return strings.TrimSpace(string(out)), nil
} }
var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: ([\d]+) Megabytes`) var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: (\d+) Megabytes`)
func globalZoneMemoryCapacity() (uint64, error) { func globalZoneMemoryCapacity() (uint64, error) {
prtconf, err := exec.LookPath("prtconf") prtconf, err := exec.LookPath("prtconf")
@ -94,7 +94,7 @@ func globalZoneMemoryCapacity() (uint64, error) {
return totalMB * 1024 * 1024, nil return totalMB * 1024 * 1024, nil
} }
var kstatMatch = regexp.MustCompile(`([^\s]+)[\s]+([^\s]*)`) var kstatMatch = regexp.MustCompile(`(\S+)\s+(\S*)`)
func nonGlobalZoneMemoryCapacity() (uint64, error) { func nonGlobalZoneMemoryCapacity() (uint64, error) {
kstat, err := exec.LookPath("kstat") kstat, err := exec.LookPath("kstat")

@ -67,7 +67,7 @@ func zoneName() (string, error) {
return strings.TrimSpace(string(out)), nil return strings.TrimSpace(string(out)), nil
} }
var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: ([\d]+) Megabytes`) var globalZoneMemoryCapacityMatch = regexp.MustCompile(`[Mm]emory size: (\d+) Megabytes`)
func globalZoneMemoryCapacity() (uint64, error) { func globalZoneMemoryCapacity() (uint64, error) {
prtconf, err := exec.LookPath("prtconf") prtconf, err := exec.LookPath("prtconf")
@ -94,7 +94,7 @@ func globalZoneMemoryCapacity() (uint64, error) {
return totalMB * 1024 * 1024, nil return totalMB * 1024 * 1024, nil
} }
var kstatMatch = regexp.MustCompile(`([^\s]+)[\s]+([^\s]*)`) var kstatMatch = regexp.MustCompile(`(\S+)\s+(\S*)`)
func nonGlobalZoneMemoryCapacity() (uint64, error) { func nonGlobalZoneMemoryCapacity() (uint64, error) {
kstat, err := exec.LookPath("kstat") kstat, err := exec.LookPath("kstat")

Loading…
Cancel
Save