Browse Source

More idiomatic names

v0
Wijnand Modderman-Lenstra 3 years ago
parent
commit
a87a955f44
4 changed files with 9 additions and 9 deletions
  1. 6
    6
      memory.go
  2. 1
    1
      memory_darwin.go
  3. 1
    1
      memory_linux.go
  4. 1
    1
      memory_test.go

+ 6
- 6
memory.go View File

@@ -1,7 +1,7 @@
1 1
 package system
2 2
 
3
-// Memory contains memory information statistics.
4
-type Memory struct {
3
+// MemoryInfo contains memory information statistics.
4
+type MemoryInfo struct {
5 5
 	Size       uint64
6 6
 	Used       uint64
7 7
 	Free       uint64
@@ -12,13 +12,13 @@ type Memory struct {
12 12
 	ActualUsed uint64
13 13
 }
14 14
 
15
-// GetMemory returns the current memory statistics.
16
-func GetMemory() (*Memory, error) {
17
-	m := new(Memory)
15
+// Memory returns the current memory statistics.
16
+func Memory() (*MemoryInfo, error) {
17
+	m := new(MemoryInfo)
18 18
 	return m, m.Get()
19 19
 }
20 20
 
21 21
 // Get the current memory statistics.
22
-func (mem *Memory) Get() (err error) {
22
+func (mem *MemoryInfo) Get() (err error) {
23 23
 	return mem.get()
24 24
 }

+ 1
- 1
memory_darwin.go View File

@@ -12,7 +12,7 @@ import (
12 12
 	"unsafe"
13 13
 )
14 14
 
15
-func (mem *Memory) get() (err error) {
15
+func (mem *MemoryInfo) get() (err error) {
16 16
 	var vmstat C.vm_statistics_data_t
17 17
 
18 18
 	if err := sysctlbyname("hw.memsize", &mem.Size); err != nil {

+ 1
- 1
memory_linux.go View File

@@ -2,7 +2,7 @@ package system
2 2
 
3 3
 import "syscall"
4 4
 
5
-func (mem *Memory) get() (err error) {
5
+func (mem *MemoryInfo) get() (err error) {
6 6
 	sysinfo := syscall.Sysinfo_t{}
7 7
 	if err := syscall.Sysinfo(&sysinfo); err != nil {
8 8
 		return err

+ 1
- 1
memory_test.go View File

@@ -3,7 +3,7 @@ package system
3 3
 import "testing"
4 4
 
5 5
 func TestMemory(t *testing.T) {
6
-	m, err := GetMemory()
6
+	m, err := Memory()
7 7
 	if err != nil {
8 8
 		t.Fatal(err)
9 9
 	}

Loading…
Cancel
Save