mirror of
https://github.com/lxc/go-lxc.git
synced 2026-02-05 06:46:38 +01:00
convert last fmt.Error to the new format and drop name field
This commit is contained in:
@@ -29,7 +29,6 @@ type Container struct {
|
||||
container *C.struct_lxc_container
|
||||
mu sync.RWMutex
|
||||
|
||||
name string
|
||||
verbosity Verbosity
|
||||
}
|
||||
|
||||
@@ -163,7 +162,7 @@ func (c *Container) Snapshots() ([]Snapshot, error) {
|
||||
defer freeSnapshots(csnapshots, size)
|
||||
|
||||
if size < 1 {
|
||||
return nil, fmt.Errorf("%s has no snapshots", c.name)
|
||||
return nil, ErrNoSnapshot
|
||||
}
|
||||
|
||||
p := uintptr(unsafe.Pointer(csnapshots))
|
||||
|
||||
3
error.go
3
error.go
@@ -26,7 +26,9 @@ var (
|
||||
ErrKMemLimit = NewError("your kernel does not support cgroup memory controller")
|
||||
ErrLoadConfigFailed = NewError("loading config file for the container failed")
|
||||
ErrMemLimit = NewError("your kernel does not support cgroup memory controller")
|
||||
ErrMemorySwapLimit = NewError("your kernel does not support cgroup swap controller")
|
||||
ErrNewFailed = NewError("allocating the container failed")
|
||||
ErrNoSnapshot = NewError("container has no snapshot")
|
||||
ErrNotDefined = NewError("container is not defined")
|
||||
ErrNotFrozen = NewError("container is not frozen")
|
||||
ErrNotRunning = NewError("container is not running")
|
||||
@@ -44,7 +46,6 @@ var (
|
||||
ErrShutdownFailed = NewError("shutting down the container failed")
|
||||
ErrStartFailed = NewError("starting the container failed")
|
||||
ErrStopFailed = NewError("stopping the container failed")
|
||||
ErrMemorySwapLimit = NewError("your kernel does not support cgroup swap controller")
|
||||
ErrUnfreezeFailed = NewError("unfreezing the container failed")
|
||||
)
|
||||
|
||||
|
||||
2
lxc.go
2
lxc.go
@@ -36,7 +36,7 @@ func NewContainer(name string, lxcpath ...string) (*Container, error) {
|
||||
if container == nil {
|
||||
return nil, ErrNewFailed
|
||||
}
|
||||
return &Container{container: container, verbosity: Quiet, name: name}, nil
|
||||
return &Container{container: container, verbosity: Quiet}, nil
|
||||
}
|
||||
|
||||
// GetContainer increments the reference counter of the container object.
|
||||
|
||||
Reference in New Issue
Block a user