code: func makeBundle(filename string, bundler chan *x509.Certificate) {
  	file, err := os.Create(filename)
  	if err != nil {
  		log.Errorf("%v", err)
  		return
  	}
  	defer file.Close()
  
  	var total int
  	for {
  		cert, ok := <-bundler
  		if !ok {
  			break
  		}
  		block := &pem.Block{
  			Type:  "CERTIFICATE",
  			Bytes: cert.Raw,
  		}
  		err = pem.Encode(file, block)
  		if err != nil {
  			log.Errorf("Failed to write PEM block: %v", err)
  			break
  		}
  		total++
  	}
  	log.Infof("Wrote %d certificates.", total)
  }
docs: // makeBundle opens the file for writing, and listens for incoming
  // certificates. These are PEM-encoded and written to file.