...
1
2
3 package wclayer
4
5 import (
6 "context"
7
8 "github.com/Microsoft/go-winio/pkg/guid"
9 "github.com/Microsoft/hcsshim/internal/hcserror"
10 "github.com/Microsoft/hcsshim/internal/oc"
11 "go.opencensus.io/trace"
12 )
13
14
15
16
17 func NameToGuid(ctx context.Context, name string) (_ guid.GUID, err error) {
18 title := "hcsshim::NameToGuid"
19 ctx, span := oc.StartSpan(ctx, title)
20 defer span.End()
21 defer func() { oc.SetSpanStatus(span, err) }()
22 span.AddAttributes(trace.StringAttribute("objectName", name))
23
24 var id guid.GUID
25 err = nameToGuid(name, &id)
26 if err != nil {
27 return guid.GUID{}, hcserror.New(err, title, "")
28 }
29 span.AddAttributes(trace.StringAttribute("guid", id.String()))
30 return id, nil
31 }
32
View as plain text