github.com/aavshr/aws-sdk-go@v1.41.3/internal/context/background_go1.5.go (about)

     1  //go:build !go1.7
     2  // +build !go1.7
     3  
     4  package context
     5  
     6  import "time"
     7  
     8  // An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to
     9  // provide a 1.6 and 1.5 safe version of context that is compatible with Go
    10  // 1.7's Context.
    11  //
    12  // An emptyCtx is never canceled, has no values, and has no deadline. It is not
    13  // struct{}, since vars of this type must have distinct addresses.
    14  type emptyCtx int
    15  
    16  func (*emptyCtx) Deadline() (deadline time.Time, ok bool) {
    17  	return
    18  }
    19  
    20  func (*emptyCtx) Done() <-chan struct{} {
    21  	return nil
    22  }
    23  
    24  func (*emptyCtx) Err() error {
    25  	return nil
    26  }
    27  
    28  func (*emptyCtx) Value(key interface{}) interface{} {
    29  	return nil
    30  }
    31  
    32  func (e *emptyCtx) String() string {
    33  	switch e {
    34  	case BackgroundCtx:
    35  		return "aws.BackgroundContext"
    36  	}
    37  	return "unknown empty Context"
    38  }
    39  
    40  // BackgroundCtx is the common base context.
    41  var BackgroundCtx = new(emptyCtx)