Put saves the value with key in the environment. Example: env := NewEnvironment(t) env.Put("key1", "str") env.Put("key2", 123)
(key string, value interface{})
| 59 | // env.Put("key1", "str") |
| 60 | // env.Put("key2", 123) |
| 61 | func (e *Environment) Put(key string, value interface{}) { |
| 62 | opChain := e.chain.enter("Put(%q)", key) |
| 63 | defer opChain.leave() |
| 64 | |
| 65 | e.mu.Lock() |
| 66 | defer e.mu.Unlock() |
| 67 | |
| 68 | e.data[key] = value |
| 69 | } |
| 70 | |
| 71 | // Delete removes the value with key from the environment. |
| 72 | // |