This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | type Example struct { | |
| ManualOverride1 string `envconfig:"manual_override_1"` | |
| DefaultVar string `default:"foobar"` | |
| RequiredVar string `required:"true"` | |
| IgnoredVar string `ignored:"true"` | |
| AutoSplitVar string `split_words:"true"` | |
| RequiredAndAutoSplitVar string `required:"true" split_words:"true"` | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | format := "Debug: %v\nPort: %d\nUser: %s\nRate: %f\nTimeout: %s\n" | |
| _, err = fmt.Printf(format, s.Debug, s.Port, s.User, s.Rate, s.Timeout) | |
| if err != nil { | |
| log.Fatal(err.Error()) | |
| } | |
| fmt.Println("Users:") | |
| for _, u := range s.Users { | |
| fmt.Printf(" %s\n", u) | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var spec Specification | |
| err := envconfig.Process("myapp", &spec) | |
| if err != nil { | |
| log.Fatal(err.Error()) | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | type Specification struct { | |
| Debug bool | |
| Port int | |
| Users []string | |
| Rate float32 | |
| Timeout time.Duration | |
| ColorCodes map[string]int | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package kafka | |
| type Consumer struct { | |
| } | |
| func NewConsumer() Consumer { | |
| return Consumer{} | |
| } | |
| func (c Consumer) Consume() error { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package kafka | |
| type Producer struct { | |
| } | |
| func NewProducer() Producer { | |
| return Producer{} | |
| } | |
| func (p Producer) Produce(msg string) error { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package kafka | |
| type Producer struct { | |
| } | |
| func NewProducer() Producer { | |
| return Producer{} | |
| } | |
| func (p Producer) Produce(msg string) error { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package product | |
| type Product struct { | |
| } | |
| func New() Product { | |
| return Product{} | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package cart | |
| type Cart struct { | |
| } | |
| func New() *Cart { | |
| return &Cart{} | |
| } | |
| type Product struct { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package cart | |
| func (c *Cart) Add(p Product) error { | |
| } | 
NewerOlder