~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Ondřej Surý, Ondřej Surý, Michael Stapelberg
  • Date: 2012-06-28 12:14:15 UTC
  • mfrom: (14.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20120628121415-rujz1ij5jcwhrhpe
Tags: 2:1.0.2-1
[ Ondřej Surý ]
* Imported Upstream version 1.0.2
* Update Vcs fields to reflect new git repository location
* Kill get-orig-source, since 1.0.0, the tarballs can be downloaded
  from webpage

[ Michael Stapelberg ]
* golang-mode: use debian-pkg-add-load-path-item (Closes: #664802)
* Add manpages (Closes: #632964)
* Use updated pt.po from Pedro Ribeiro (Closes: #674958)

Show diffs side-by-side

added added

removed removed

Lines of Context:
144
144
                }
145
145
        }
146
146
 
147
 
        fmt.Fprintf(os.Stderr, "Unknown command %#q\n\n", args[0])
148
 
        usage()
 
147
        fmt.Fprintf(os.Stderr, "go: unknown subcommand %q\nRun 'go help' for usage.\n", args[0])
 
148
        setExitStatus(2)
 
149
        exit()
149
150
}
150
151
 
151
152
var usageTemplate = `Go is a tool for managing Go source code.
339
340
 
340
341
func run(cmdargs ...interface{}) {
341
342
        cmdline := stringList(cmdargs...)
 
343
        if buildN || buildV {
 
344
                fmt.Printf("%s\n", strings.Join(cmdline, " "))
 
345
                if buildN {
 
346
                        return
 
347
                }
 
348
        }
 
349
 
342
350
        cmd := exec.Command(cmdline[0], cmdline[1:]...)
343
351
        cmd.Stdout = os.Stdout
344
352
        cmd.Stderr = os.Stderr
500
508
 
501
509
        var pkgs []string
502
510
        filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
503
 
                if err != nil || !fi.IsDir() || path == dir {
 
511
                if err != nil || !fi.IsDir() {
504
512
                        return nil
505
513
                }
 
514
                if path == dir {
 
515
                        // filepath.Walk starts at dir and recurses. For the recursive case,
 
516
                        // the path is the result of filepath.Join, which calls filepath.Clean.
 
517
                        // The initial case is not Cleaned, though, so we do this explicitly.
 
518
                        //
 
519
                        // This converts a path like "./io/" to "io". Without this step, running
 
520
                        // "cd $GOROOT/src/pkg; go list ./io/..." would incorrectly skip the io
 
521
                        // package, because prepending the prefix "./" to the unclean path would
 
522
                        // result in "././io", and match("././io") returns false.
 
523
                        path = filepath.Clean(path)
 
524
                }
506
525
 
507
 
                // Avoid .foo, _foo, and testdata directory trees.
 
526
                // Avoid .foo, _foo, and testdata directory trees, but do not avoid "." or "..".
508
527
                _, elem := filepath.Split(path)
509
 
                if strings.HasPrefix(elem, ".") || strings.HasPrefix(elem, "_") || elem == "testdata" {
 
528
                dot := strings.HasPrefix(elem, ".") && elem != "." && elem != ".."
 
529
                if dot || strings.HasPrefix(elem, "_") || elem == "testdata" {
510
530
                        return filepath.SkipDir
511
531
                }
512
532