{"modulePath":"github.com/cobaltcore-dev/kvm-node-agent","version":"v0.2.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package kernel\n\nPackage kernel provides functions to read kernel parameters from the system.\n\n## Constants\n\n```go\nconst DefaultCmdlinePath = \"/proc/cmdline\"\n```\nDefaultCmdlinePath is the default path to the kernel command line.\n\n## Types\n\n```go\ntype Interface interface {\n\t// ReadParameters reads and returns kernel parameters from the system.\n\tReadParameters() (*Parameters, error)\n}\n```\nInterface provides an interface for reading kernel parameters.\n\n```go\ntype InterfaceMock struct {\n\t// ReadParametersFunc mocks the ReadParameters method.\n\tReadParametersFunc func() (*Parameters, error)\n\t// contains filtered or unexported fields\n}\n```\nInterfaceMock is a mock implementation of Interface.\n\n\tfunc TestSomethingThatUsesInterface(t *testing.T) {\n\n\t\t// make and configure a mocked Interface\n\t\tmockedInterface := \u0026InterfaceMock{\n\t\t\tReadParametersFunc: func() (*Parameters, error) {\n\t\t\t\tpanic(\"mock out the ReadParameters method\")\n\t\t\t},\n\t\t}\n\n\t\t// use mockedInterface in code that requires Interface\n\t\t// and then make assertions.\n\n\t}\n\n```go\nfunc (mock *InterfaceMock) ReadParameters() (*Parameters, error)\n```\nReadParameters calls ReadParametersFunc.\n\n```go\nfunc (mock *InterfaceMock) ReadParametersCalls() []struct {\n}\n```\nReadParametersCalls gets all the calls that were made to ReadParameters. Check the length with:\n\n\tlen(mockedInterface.ReadParametersCalls())\n\n```go\ntype Parameters struct {\n\t// CommandLine contains the raw kernel boot parameters from /proc/cmdline.\n\tCommandLine string\n}\n```\nParameters holds kernel boot parameters.\n\n```go\ntype SystemReader struct {\n\t// contains filtered or unexported fields\n}\n```\nSystemReader reads kernel parameters from the actual system files.\n\n```go\nfunc NewSystemReader() *SystemReader\n```\nNewSystemReader creates a new SystemReader with the default cmdline path.\n\n```go\nfunc NewSystemReaderWithPath(cmdlinePath string) *SystemReader\n```\nNewSystemReaderWithPath creates a new SystemReader with a custom cmdline path. This is useful for testing.\n\n```go\nfunc (r *SystemReader) ReadParameters() (*Parameters, error)\n```\nReadParameters reads kernel parameters from /proc/cmdline and returns them as a Parameters struct with the raw command line content.\n\n","path":"github.com/cobaltcore-dev/kvm-node-agent/internal/kernel","name":"kernel","synopsis":"Package kernel provides functions to read kernel parameters from the system.","isRedistributable":true}
