~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/cmd/hgpatch/main.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
176
176
                list[i] = f
177
177
                i++
178
178
        }
179
 
        sort.SortStrings(list)
 
179
        sort.Strings(list)
180
180
        for _, f := range list {
181
181
                fmt.Printf("%s\n", f)
182
182
        }
282
282
        if err != nil {
283
283
                return nil, err
284
284
        }
285
 
        return strings.Split(strings.TrimSpace(out), "\n", -1), nil
 
285
        return strings.Split(strings.TrimSpace(out), "\n"), nil
286
286
}
287
287
 
288
288
// hgAdd adds name to the repository.
329
329
// It provides input on standard input to the command.
330
330
func run(argv []string, input []byte) (out string, err os.Error) {
331
331
        if len(argv) < 1 {
332
 
                err = os.EINVAL
333
 
                goto Error
 
332
                return "", &runError{dup(argv), os.EINVAL}
334
333
        }
335
334
 
336
335
        prog, ok := lookPathCache[argv[0]]
337
336
        if !ok {
338
337
                prog, err = exec.LookPath(argv[0])
339
338
                if err != nil {
340
 
                        goto Error
 
339
                        return "", &runError{dup(argv), err}
341
340
                }
342
341
                lookPathCache[argv[0]] = prog
343
342
        }
347
346
                cmd.Stdin = bytes.NewBuffer(input)
348
347
        }
349
348
        bs, err := cmd.CombinedOutput()
350
 
        if err == nil {
351
 
                return string(bs), nil
 
349
        if err != nil {
 
350
                return "", &runError{dup(argv), err}
352
351
        }
353
 
 
354
 
Error:
355
 
        err = &runError{dup(argv), err}
356
 
        return
 
352
        return string(bs), nil
357
353
}
358
354
 
359
355
// A runError represents an error that occurred while running a command.