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

move supporting code into separate packages #193

Merged
merged 21 commits into from
Jun 4, 2020
Merged

move supporting code into separate packages #193

merged 21 commits into from
Jun 4, 2020

Conversation

jaypipes
Copy link
Owner

@jaypipes jaypipes commented Jun 1, 2020

Massive reworking of the source repository here, but all should be backwards-compatible with ghw's API.

Individual packages have been created for all the major discovery elements, like CPU, GPU, network, etc. Utility code has been moved into separate packages as well.

A new alias.go file accomplishes backwards compatibility with the old ghw API, allowing aliasing of, for example, ghw.CPU() to the new location ghw/pkg/cpu.New().

The main directory of `ghw` is getting a little long in the tooth, so
I'm going to be moving things into their own packages. This first pass
puts the (previously private, now public) Context and Option structs
into their own packages and updates all the primary call logic to pass
in a Context object instead of having methods on the private context
struct.
We're prepping for the 1.0 release and so goes the fields and functions
that were marked as DEPRECATED over two years ago and warnings made that
1.0 release would remove them.
Moves all the linux path construction (obeying Context.Chroot) to a new
`ghw/pkg/linuxpath` package.
Continuing to clean up the main directory, this patch moves utility code
like Warn(), SafeCloser() etc into a `ghw/pkg/util` package.
Moves the SafeYAML and SafeJSON functions into a `ghw/pkg/marshal`
package.
Moves the unitWithString function to a `ghw/pkg/unitutil` package and
renames it `AmountString`
Moves all CPU functionality into `ghw/pkg/cpu` and uses aliasing in the
top-level directory to keep backwards compatibiliy with the `ghw.CPU()`
function.
Moves Memory(), CachesForNode() into `ghw/pkg/memory`
Moves all functionality related to block device, disk and partition
discovery into a separate `ghw/pkg/block` package.
Continues the rounds of package separation, this time moving all
network-related functionality into `ghw/pkg/net`
Moves the dmi_linux.go:dmiItem() code into `ghw/pkg/linuxdmi:Item()`
Moves all BIOS discovery into `ghw/pkg/bios`
Moves all chassis discovery functionality into `ghw/pkg/chassis`
Moves baseboard discovery functionality to `ghw/pkg/baseboard`
Moves all topology discovery functionality into `ghw/pkg/topology`
including housing the architecture constants in there and aliasing them
into the main ghw package namespace.
Moves PCI discovery functionality into `ghw/pkg/pci`
Moves product discovery functionality into `ghw/pkg/product`
Moves GPU discovery functionality into `ghw/pkg/gpu`
Renames main.go -> host.go
Deletes an old bios_linux.go that somehow snuck in.
With `ghw` v1.0, support for `dep` and Go <1.13 is removed.
@jaypipes jaypipes merged commit c3d044b into master Jun 4, 2020
@jaypipes jaypipes deleted the pkg-cleanup branch February 2, 2021 12:26
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.

1 participant