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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 toRoot targetDir = iota // to bin dir inside package root (default) | 300 toRoot targetDir = iota // to bin dir inside package root (default) |
301 toTool // GOROOT/pkg/tool | 301 toTool // GOROOT/pkg/tool |
302 toBin // GOROOT/bin | 302 toBin // GOROOT/bin |
303 ) | 303 ) |
304 | 304 |
305 // goTools is a map of Go program import path to install target directory. | 305 // goTools is a map of Go program import path to install target directory. |
306 var goTools = map[string]targetDir{ | 306 var goTools = map[string]targetDir{ |
307 "cmd/api": toTool, | 307 "cmd/api": toTool, |
308 "cmd/cgo": toTool, | 308 "cmd/cgo": toTool, |
309 "cmd/fix": toTool, | 309 "cmd/fix": toTool, |
| 310 "cmd/nm": toTool, |
310 "cmd/yacc": toTool, | 311 "cmd/yacc": toTool, |
311 "code.google.com/p/go.tools/cmd/cover": toTool, | 312 "code.google.com/p/go.tools/cmd/cover": toTool, |
312 "code.google.com/p/go.tools/cmd/godoc": toBin, | 313 "code.google.com/p/go.tools/cmd/godoc": toBin, |
313 "code.google.com/p/go.tools/cmd/vet": toTool, | 314 "code.google.com/p/go.tools/cmd/vet": toTool, |
314 } | 315 } |
315 | 316 |
316 // expandScanner expands a scanner.List error into all the errors in the list. | 317 // expandScanner expands a scanner.List error into all the errors in the list. |
317 // The default Error method only shows the first error. | 318 // The default Error method only shows the first error. |
318 func expandScanner(err error) error { | 319 func expandScanner(err error) error { |
319 // Look for parser errors. | 320 // Look for parser errors. |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 root = filepath.Clean(root) | 852 root = filepath.Clean(root) |
852 if !strings.HasSuffix(root, sep) { | 853 if !strings.HasSuffix(root, sep) { |
853 root += sep | 854 root += sep |
854 } | 855 } |
855 dir = filepath.Clean(dir) | 856 dir = filepath.Clean(dir) |
856 if !strings.HasPrefix(dir, root) { | 857 if !strings.HasPrefix(dir, root) { |
857 return "", false | 858 return "", false |
858 } | 859 } |
859 return filepath.ToSlash(dir[len(root):]), true | 860 return filepath.ToSlash(dir[len(root):]), true |
860 } | 861 } |
LEFT | RIGHT |