(files map[string]*shared.GistFile)
| 241 | } |
| 242 | |
| 243 | func guessGistName(files map[string]*shared.GistFile) string { |
| 244 | filenames := make([]string, 0, len(files)) |
| 245 | gistName := "" |
| 246 | |
| 247 | re := regexp.MustCompile(`^gistfile\d+\.txt$`) |
| 248 | for k := range files { |
| 249 | if !re.MatchString(k) { |
| 250 | filenames = append(filenames, k) |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | if len(filenames) > 0 { |
| 255 | sort.Strings(filenames) |
| 256 | gistName = filenames[0] |
| 257 | } |
| 258 | |
| 259 | return gistName |
| 260 | } |
| 261 | |
| 262 | func createGist(client *http.Client, hostname, description string, public bool, files map[string]*shared.GistFile) (*shared.Gist, error) { |
| 263 | body := &shared.Gist{ |
no outgoing calls