code: func NewWriter(w io.Writer, h *Header, flags int) (*Writer, error) {
  	if flags < FlagDecimal || flags > FlagString {
  		return nil, errors.New("bam: flag format option out of range")
  	}
  	sw := &Writer{w: w, flags: flags}
  	text, _ := h.MarshalText()
  	_, err := w.Write(text)
  	if err != nil {
  		return nil, err
  	}
  	return sw, nil
  }
docs: // NewWriter returns a Writer to the given io.Writer using h for the SAM
  // header. The format of flags for SAM lines can be FlagDecimal, FlagHex
  // or FlagString.