| 397 | } |
| 398 | |
| 399 | func updateGist(apiClient *api.Client, hostname string, gist gistToUpdate) error { |
| 400 | requestByte, err := json.Marshal(gist) |
| 401 | if err != nil { |
| 402 | return err |
| 403 | } |
| 404 | |
| 405 | requestBody := bytes.NewReader(requestByte) |
| 406 | result := shared.Gist{} |
| 407 | |
| 408 | path, err := safeurl.JoinPath("gists", gist.id) |
| 409 | if err != nil { |
| 410 | return err |
| 411 | } |
| 412 | err = apiClient.REST(hostname, "POST", path.String(), requestBody, &result) |
| 413 | if err != nil { |
| 414 | return err |
| 415 | } |
| 416 | |
| 417 | return nil |
| 418 | } |
| 419 | |
| 420 | func getFilesToAdd(file string, content []byte) (map[string]*gistFileToUpdate, error) { |
| 421 | if shared.IsBinaryContents(content) { |