From bdca406b2cf89f029207aa8213460ec7a3267ccc Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 8 Jul 2024 12:45:31 +0200 Subject: vm: make Instance implement io.Closer It's better to follow standard interfaces. --- vm/gce/gce.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'vm/gce') diff --git a/vm/gce/gce.go b/vm/gce/gce.go index 12f49e3d7..8de0b56db 100644 --- a/vm/gce/gce.go +++ b/vm/gce/gce.go @@ -241,12 +241,16 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) { return inst, nil } -func (inst *instance) Close() { +func (inst *instance) Close() error { close(inst.closed) - inst.GCE.DeleteInstance(inst.name, false) + err := inst.GCE.DeleteInstance(inst.name, false) if inst.consolew != nil { - inst.consolew.Close() + err2 := inst.consolew.Close() + if err == nil { + err = err2 + } } + return err } func (inst *instance) Forward(port int) (string, error) { -- cgit mrf-deployment