MCPcopy
hub / github.com/luk4z7/go-concurrency-guide / genFarewell

Function genFarewell

patterns/contextpackage/cancel/main.go:68–76  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

66}
67
68func genFarewell(ctx context.Context) (string, error) {
69 switch locale, err := locale(ctx); {
70 case err != nil:
71 return "", err
72 case locale == "EN/US":
73 return "goodbye", nil
74 }
75 return "", fmt.Errorf("unsupported locale")
76}
77
78func locale(ctx context.Context) (string, error) {
79 if deadline, ok := ctx.Deadline(); ok {

Callers 1

printFarewellFunction · 0.85

Calls 1

localeFunction · 0.85

Tested by

no test coverage detected