Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build CPUInfo on Darwin #692

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

localhots
Copy link

cpuinfo.go is currently only built on Linux and it breaks Darwin builds for no apparent reason.
I understand that there's no procfs on Darwin but it should still be possible to use macOS for development of projects that use this package.

This change allows it to be built on Darwin with a dummy parseCPUInfo implementation.

Please let me know if I need to change this solution in any way. Thanks!

Signed-off-by: Gregory Eremin <[email protected]>
Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the correct fix, it would likely break other OSs.

@@ -0,0 +1,19 @@
// Copyright 2020 The Prometheus Authors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Copyright 2020 The Prometheus Authors
// Copyright 2025 The Prometheus Authors

Comment on lines -14 to -15
//go:build linux
// +build linux
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this will likely break other non-linux non-darwin OSs like BSDs, etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was worried about that too but couldn't find a better solution. Will you be able to suggest better build tags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants