code: func isText(rs io.ReadSeeker) (ok bool, err error) {
  	defer func() {
  		if _, seekErr := rs.Seek(0, io.SeekStart); seekErr != nil {
  			if err == nil {
  				err = seekErr
  			}
  		}
  	}()
  	var buf bytes.Buffer
  	if _, err := io.CopyN(&buf, rs, 1e6); err != nil {
  		if err != io.EOF {
  			return false, err
  		}
  	}
  	return utf8.Valid(buf.Bytes()), nil
  }
docs: // isText reports whether the first MB read from rs is valid UTF-8 text.