Computer scienceProgramming languagesGolangPackages and modulesStandard libraryContext package

Context package

Looking for a Value

Report a typo

Rearrange the lines so that the resulting function would print the value for the key if it's found in the context and a special message if it's not found.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                return
              
                }
              
                if val := ctx.Value(key); val != nil {
              
                fmt.Println(key, "value is not found")
              
                func lookForValue(ctx context.Context, key myVeryOwnContextKey) {
              
                fmt.Println("value for", key, "is", val)
              
                }
              
___

Create a free account to access the full topic