-
Notifications
You must be signed in to change notification settings - Fork 189
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 oldghw
API, allowing aliasing of, for example,ghw.CPU()
to the new locationghw/pkg/cpu.New()
.