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

use Go idiomatic naming for Architecture consts #379

Merged
merged 1 commit into from
Sep 25, 2024
Merged

use Go idiomatic naming for Architecture consts #379

merged 1 commit into from
Sep 25, 2024

Conversation

jaypipes
Copy link
Owner

Updates the ARCHITECTURE_SMP and ARCHITECTURE_NUMA constants to ArchitectureSMP and ArchitectureNUMA, respectively, to align with idiomatic Go naming conventions.

For backwards-compat, keeps ARCHITECTURE_SMP and ARCHITECTURE_NUMA in the aliased variables for a few releases. These will be discarded when we cut a v1.0 series.

Copy link
Collaborator

@ffromani ffromani left a comment

Choose a reason for hiding this comment

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

IIRC ghw/pkg/... are also part of our public API?
A (unfortunately very quick) scan of the README seems inconclusive, even if admittedly top-level aliases are suggested most.
In any case, eventually we do report to users ghw.TopologyInfo.Architecture which is filled using the new constants, so it seems we have a small annoying backward compatibility break here :\

Comment on lines +29 to +31
ArchitectureSMP Architecture = iota
// NUMA is a Non-Uniform Memory Access system
ARCHITECTURE_NUMA
ArchitectureNUMA
Copy link
Collaborator

Choose a reason for hiding this comment

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

IIRC we do allow importing sub-packages (import github.com/jaypipes/ghw/pkg/topology) and these are part of the public API. If so we need the backward compatibility also here

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ack, makes sense. I'll add the pkg/-specific old names back in, with deprecation warnings.

Copy link
Owner Author

Choose a reason for hiding this comment

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

done.

Updates the `ARCHITECTURE_SMP` and `ARCHITECTURE_NUMA` constants to
`ArchitectureSMP` and `ArchitectureNUMA`, respectively, to align with
idiomatic Go naming conventions.

For backwards-compat, keeps `ARCHITECTURE_SMP` and `ARCHITECTURE_NUMA`
in the aliased variables for a few releases. These will be discarded
when we cut a v1.0 series.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
@ffromani
Copy link
Collaborator

Thanks @jaypipes I think this is the best we can do atm.

@ffromani ffromani merged commit 197a485 into main Sep 25, 2024
14 checks passed
@ffromani ffromani deleted the idiomatic branch September 25, 2024 11:49
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