github.com/packtpublishing/learning-functional-programming-in-go@v0.0.0-20230130084745-8b849f6d58c4/Chapter04/02_misc/misc.go (about)

     1  package main
     2  
     3  
     4  
     5  //import "theirpkg"
     6  
     7  //func MyFunction(t *theirpkg.AType)
     8  //
     9  //func MyOtherFunction(i theirpkg.AnInterface)
    10  
    11  
    12  
    13  type errorBehavior interface {
    14  	Retryable() bool
    15  }
    16  
    17  
    18  func IsRetryable(err error) bool {
    19  	eb, ok := err.(errorBehavior)
    20  	return ok && eb.Retryable()
    21  }
    22  
    23  
    24  //type writeFlusher interface {
    25  //     io.Writer
    26  //     http.Flusher
    27  //}
    28  
    29  
    30  
    31  
    32  
    33  func main() {
    34  
    35  }
    36  
    37  /*
    38  
    39  - Foot, paddle!
    40  - Foot, paddle!
    41  - Foot, paddle!
    42  - Bill, eat a bug!
    43  - Foot, paddle!
    44  - Foot, paddle!
    45  - Bill, eat a bug!
    46  ----------------------
    47  Ponds Processed:
    48  {BugSupply:1 StrokesRequired:3}
    49  {BugSupply:1 StrokesRequired:2}
    50  Strokes remaining: 2
    51  ----------------------
    52  
    53  
    54  
    55  - Foot, paddle!
    56  - Foot, paddle!
    57  - Foot, paddle!
    58  
    59  
    60  2017/05/12 19:11:51 Our duck died!
    61  exit status 1
    62  
    63  
    64  
    65  
    66   */