qemu-metadata-api: allow building without cgo dependencies for linting

This commit is contained in:
Malte Poll 2023-05-17 17:34:29 +02:00 committed by Malte Poll
parent 15d51c3a3f
commit 78085cba68
8 changed files with 119 additions and 36 deletions

View file

@ -0,0 +1,33 @@
//go:build !cgo
/*
Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package virtwrapper
import "errors"
// Connect wraps a libvirt connection.
type Connect struct{}
// LookupNetworkByName looks up a network by name.
// This function errors if CGO is disabled.
func (c *Connect) LookupNetworkByName(_ string) (*Network, error) {
return nil, errors.New("using virtwrapper requires building with CGO")
}
// Network wraps a libvirt network.
type Network struct{}
// GetDHCPLeases returns the underlying DHCP leases.
// This function errors if CGO is disabled.
func (n *Network) GetDHCPLeases() ([]NetworkDHCPLease, error) {
return nil, errors.New("using virtwrapper requires building with CGO")
}
// Free the network resource.
// This function does nothing if CGO is disabled.
func (n *Network) Free() {}