code: func (s *S3Uploader) UploadToS3(fPath string, buf *bytes.Buffer) error {
  	fmt.Fprintf(s.out, "Preparing %q for upload to s3 bucket %q...", filepath.Base(fPath), s.s3url.String())
  
  	req, err := s.buildS3Request(filepath.Base(fPath), buf)
  	if err != nil {
  		fmt.Fprintln(s.out, " error")
  		return err
  	}
  	fmt.Fprintln(s.out, " done")
  
  	fmt.Fprint(s.out, "Uploading...")
  	resp, err := http.DefaultClient.Do(req)
  	if err != nil {
  		fmt.Fprintln(s.out, " error")
  		return err
  	}
  	defer resp.Body.Close()
  
  	if resp.StatusCode != http.StatusOK {
  		fmt.Fprintln(s.out, " error")
  		if resp.StatusCode == 403 {
  			fmt.Fprintln(s.out, "Encountered authorization error! Are your keys set correctly?")
  		}
  		errMsg := fmt.Sprintf("received code %d, should have received %d", resp.StatusCode, http.StatusOK)
  		b, err := ioutil.ReadAll(resp.Body)
  		if err == nil {
  			errMsg = fmt.Sprintf("%s\n\nReceived S3 Response: %q", errMsg, string(b))
  		}
  		return fmt.Errorf(errMsg)
  	}
  	fmt.Fprintln(s.out, " done")
  	return nil
  }
docs: // UploadToS3 prepares a buffer for upload to S3.