-
Notifications
You must be signed in to change notification settings - Fork 0
chore(staticcheck): clean staticcheck warnings in libvirt, protobuf, and ledger #2
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
base: feat/control-plane-ha-15day
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,10 +22,22 @@ import ( | |
| "time" | ||
|
|
||
| "github.com/digitalocean/go-libvirt" | ||
| libvirtsocket "github.com/digitalocean/go-libvirt/socket" | ||
| "github.com/google/uuid" | ||
| "github.com/poyrazk/thecloud/internal/core/ports" | ||
| ) | ||
|
|
||
| type libvirtUnixDialer struct { | ||
| uri string | ||
| timeout time.Duration | ||
| } | ||
|
|
||
| var _ libvirtsocket.Dialer = (*libvirtUnixDialer)(nil) | ||
|
|
||
| func (d *libvirtUnixDialer) Dial() (net.Conn, error) { | ||
| return net.DialTimeout("unix", d.uri, d.timeout) | ||
| } | ||
|
|
||
| const ( | ||
| defaultPoolName = "default" | ||
| userDataFileName = "user-data" | ||
|
|
@@ -110,8 +122,8 @@ func NewLibvirtAdapter(logger *slog.Logger, uri string) (*LibvirtAdapter, error) | |
| } | ||
| } | ||
|
|
||
| //nolint:staticcheck | ||
| l := libvirt.New(c) | ||
| _ = c.Close() | ||
| l := libvirt.NewWithDialer(&libvirtUnixDialer{uri: uri, timeout: 2 * time.Second}) | ||
|
Comment on lines
124
to
+126
|
||
| adapter := &LibvirtAdapter{ | ||
| client: &RealLibvirtClient{conn: l}, | ||
| logger: logger, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libvirtUnixDialerstores the unix socket path in a field nameduri, but in this packageuriis also used for libvirt connection URIs likeqemu:///system(see tests/usages). This naming makes it easy to accidentally pass a non-socket URI and haveDial()try tonet.DialTimeout("unix", "qemu:///system", ...). Consider renaming the field (and constructor arg) tosocketPath(or similar) to make the expected format explicit.