Skip to content

Commit 6471fa3

Browse files
authored
fix dupblicate cgo import, use double instead of Float64 in C function return (prometheus#3391)
Signed-off-by: Ahmed Abdulraziq <[email protected]>
1 parent 434fb7d commit 6471fa3

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

collector/filesystem_macos.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ package collector
2020
#cgo CFLAGS: -x objective-c
2121
#cgo LDFLAGS: -framework Foundation
2222
#import <Foundation/Foundation.h>
23-
Float64 purgeable(char *path) {
24-
Float64 value = -1.0f;
23+
#include <sys/param.h>
24+
#include <sys/ucred.h>
25+
#include <sys/mount.h>
26+
#include <stdio.h>
27+
28+
double purgeable(char *path) {
29+
double value = -1.0f;
2530
2631
@autoreleasepool {
2732
NSError *error = nil;
@@ -49,14 +54,6 @@ import (
4954
"unsafe"
5055
)
5156

52-
/*
53-
#include <sys/param.h>
54-
#include <sys/ucred.h>
55-
#include <sys/mount.h>
56-
#include <stdio.h>
57-
*/
58-
import "C"
59-
6057
const (
6158
defMountPointsExcluded = "^/(dev)($|/)"
6259
defFSTypesExcluded = "^devfs$"

collector/meminfo_darwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (c *meminfoCollector) getMemInfo() (map[string]float64, error) {
5252
&infoCount,
5353
)
5454
if ret != C.KERN_SUCCESS {
55-
return nil, fmt.Errorf("Couldn't get memory statistics, host_statistics returned %d", ret)
55+
return nil, fmt.Errorf("couldn't get memory statistics, host_statistics returned %d", ret)
5656
}
5757
totalb, err := unix.Sysctl("hw.memsize")
5858
if err != nil {

0 commit comments

Comments
 (0)