add comment for context (#1413)
ref #1075 annotation from go context source.
This commit is contained in:
		
							
								
								
									
										15
									
								
								context.go
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								context.go
									
									
									
									
									
								
							@ -836,18 +836,33 @@ func (c *Context) SetAccepted(formats ...string) {
 | 
				
			|||||||
/***** GOLANG.ORG/X/NET/CONTEXT *****/
 | 
					/***** GOLANG.ORG/X/NET/CONTEXT *****/
 | 
				
			||||||
/************************************/
 | 
					/************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Deadline returns the time when work done on behalf of this context
 | 
				
			||||||
 | 
					// should be canceled. Deadline returns ok==false when no deadline is
 | 
				
			||||||
 | 
					// set. Successive calls to Deadline return the same results.
 | 
				
			||||||
func (c *Context) Deadline() (deadline time.Time, ok bool) {
 | 
					func (c *Context) Deadline() (deadline time.Time, ok bool) {
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Done returns a channel that's closed when work done on behalf of this
 | 
				
			||||||
 | 
					// context should be canceled. Done may return nil if this context can
 | 
				
			||||||
 | 
					// never be canceled. Successive calls to Done return the same value.
 | 
				
			||||||
func (c *Context) Done() <-chan struct{} {
 | 
					func (c *Context) Done() <-chan struct{} {
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Err returns a non-nil error value after Done is closed,
 | 
				
			||||||
 | 
					// successive calls to Err return the same error.
 | 
				
			||||||
 | 
					// If Done is not yet closed, Err returns nil.
 | 
				
			||||||
 | 
					// If Done is closed, Err returns a non-nil error explaining why:
 | 
				
			||||||
 | 
					// Canceled if the context was canceled
 | 
				
			||||||
 | 
					// or DeadlineExceeded if the context's deadline passed.
 | 
				
			||||||
func (c *Context) Err() error {
 | 
					func (c *Context) Err() error {
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Value returns the value associated with this context for key, or nil
 | 
				
			||||||
 | 
					// if no value is associated with key. Successive calls to Value with
 | 
				
			||||||
 | 
					// the same key returns the same result.
 | 
				
			||||||
func (c *Context) Value(key interface{}) interface{} {
 | 
					func (c *Context) Value(key interface{}) interface{} {
 | 
				
			||||||
	if key == 0 {
 | 
						if key == 0 {
 | 
				
			||||||
		return c.Request
 | 
							return c.Request
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user