LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "errors" | 9 "errors" |
10 "fmt" | 10 "fmt" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 ) | 306 ) |
307 | 307 |
308 // goTools is a map of Go program import path to install target directory. | 308 // goTools is a map of Go program import path to install target directory. |
309 var goTools = map[string]targetDir{ | 309 var goTools = map[string]targetDir{ |
310 "cmd/addr2line": toTool, | 310 "cmd/addr2line": toTool, |
311 "cmd/api": toTool, | 311 "cmd/api": toTool, |
312 "cmd/cgo": toTool, | 312 "cmd/cgo": toTool, |
313 "cmd/fix": toTool, | 313 "cmd/fix": toTool, |
314 "cmd/link": toTool, | 314 "cmd/link": toTool, |
315 "cmd/nm": toTool, | 315 "cmd/nm": toTool, |
| 316 "cmd/objdump": toTool, |
316 "cmd/pack": toTool, | 317 "cmd/pack": toTool, |
317 "cmd/yacc": toTool, | 318 "cmd/yacc": toTool, |
318 "code.google.com/p/go.tools/cmd/cover": toTool, | 319 "code.google.com/p/go.tools/cmd/cover": toTool, |
319 "code.google.com/p/go.tools/cmd/godoc": toBin, | 320 "code.google.com/p/go.tools/cmd/godoc": toBin, |
320 "code.google.com/p/go.tools/cmd/vet": toTool, | 321 "code.google.com/p/go.tools/cmd/vet": toTool, |
321 } | 322 } |
322 | 323 |
323 // expandScanner expands a scanner.List error into all the errors in the list. | 324 // expandScanner expands a scanner.List error into all the errors in the list. |
324 // The default Error method only shows the first error. | 325 // The default Error method only shows the first error. |
325 func expandScanner(err error) error { | 326 func expandScanner(err error) error { |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 root = filepath.Clean(root) | 860 root = filepath.Clean(root) |
860 if !strings.HasSuffix(root, sep) { | 861 if !strings.HasSuffix(root, sep) { |
861 root += sep | 862 root += sep |
862 } | 863 } |
863 dir = filepath.Clean(dir) | 864 dir = filepath.Clean(dir) |
864 if !strings.HasPrefix(dir, root) { | 865 if !strings.HasPrefix(dir, root) { |
865 return "", false | 866 return "", false |
866 } | 867 } |
867 return filepath.ToSlash(dir[len(root):]), true | 868 return filepath.ToSlash(dir[len(root):]), true |
868 } | 869 } |
LEFT | RIGHT |