LEFT | RIGHT |
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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 buf.WriteString("\n") | 318 buf.WriteString("\n") |
319 buf.WriteString(e.Error()) | 319 buf.WriteString(e.Error()) |
320 } | 320 } |
321 return errors.New(buf.String()) | 321 return errors.New(buf.String()) |
322 } | 322 } |
323 return err | 323 return err |
324 } | 324 } |
325 | 325 |
326 var raceExclude = map[string]bool{ | 326 var raceExclude = map[string]bool{ |
327 "runtime/race": true, | 327 "runtime/race": true, |
328 » "runtime/cgo": true, | 328 » "runtime/cgo": true, |
329 » "cmd/cgo": true, | 329 » "cmd/cgo": true, |
330 » "syscall": true, | 330 » "syscall": true, |
331 » "errors": true, | 331 » "errors": true, |
332 } | 332 } |
333 | 333 |
334 var cgoExclude = map[string]bool{ | 334 var cgoExclude = map[string]bool{ |
335 "runtime/cgo": true, | 335 "runtime/cgo": true, |
336 } | 336 } |
337 | 337 |
338 var cgoSyscallExclude = map[string]bool{ | 338 var cgoSyscallExclude = map[string]bool{ |
339 » "runtime/cgo": true, | 339 » "runtime/cgo": true, |
340 "runtime/race": true, | 340 "runtime/race": true, |
341 } | 341 } |
342 | 342 |
343 // load populates p using information from bp, err, which should | 343 // load populates p using information from bp, err, which should |
344 // be the result of calling build.Context.Import. | 344 // be the result of calling build.Context.Import. |
345 func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
{ | 345 func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
{ |
346 p.copyBuild(bp) | 346 p.copyBuild(bp) |
347 | 347 |
348 // The localPrefix is the path we interpret ./ imports relative to. | 348 // The localPrefix is the path we interpret ./ imports relative to. |
349 // Synthesized main packages sometimes override this. | 349 // Synthesized main packages sometimes override this. |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 root = filepath.Clean(root) | 855 root = filepath.Clean(root) |
856 if !strings.HasSuffix(root, sep) { | 856 if !strings.HasSuffix(root, sep) { |
857 root += sep | 857 root += sep |
858 } | 858 } |
859 dir = filepath.Clean(dir) | 859 dir = filepath.Clean(dir) |
860 if !strings.HasPrefix(dir, root) { | 860 if !strings.HasPrefix(dir, root) { |
861 return "", false | 861 return "", false |
862 } | 862 } |
863 return filepath.ToSlash(dir[len(root):]), true | 863 return filepath.ToSlash(dir[len(root):]), true |
864 } | 864 } |
LEFT | RIGHT |