From 21cc694d894451590f7cb73731c07a718c22a824 Mon Sep 17 00:00:00 2001 From: Pawel Stolowski Date: Thu, 5 Oct 2017 10:03:28 +0200 Subject: [PATCH] plugRef/slotRef helpers for PlugInfo/SlotInfo. --- interfaces/core.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/interfaces/core.go b/interfaces/core.go index 5455db5ed14..c7e17023591 100644 --- a/interfaces/core.go +++ b/interfaces/core.go @@ -35,7 +35,11 @@ type Plug struct { // Ref returns reference to a plug func (plug *Plug) Ref() PlugRef { - return PlugRef{Snap: plug.Snap.Name(), Name: plug.Name} + return plugRef(plug.PlugInfo) +} + +func plugRef(plugInfo *snap.PlugInfo) PlugRef { + return PlugRef{Snap: plugInfo.Snap.Name(), Name: plugInfo.Name} } // Sanitize plug with a given snapd interface. @@ -70,7 +74,11 @@ type Slot struct { // Ref returns reference to a slot func (slot *Slot) Ref() SlotRef { - return SlotRef{Snap: slot.Snap.Name(), Name: slot.Name} + return slotRef(slot.SlotInfo) +} + +func slotRef(slotInfo *snap.SlotInfo) SlotRef { + return SlotRef{Snap: slotInfo.Snap.Name(), Name: slotInfo.Name} } // Sanitize slot with a given snapd interface.