Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Delta Between Two Patch Sets: src/cmd/go/pkg.go

Issue 5732045: code review 5732045: cmd/go: fix relative imports again (Closed)
Left Patch Set: diff -r ada18e5ef51f https://code.google.com/p/go/ Created 13 years ago
Right Patch Set: diff -r 3fdde99ed034 https://code.google.com/p/go/ Created 13 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/go/build.go ('k') | src/cmd/go/run.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 Deps []string `json:",omitempty"` // all (recursively) impo rted dependencies 54 Deps []string `json:",omitempty"` // all (recursively) impo rted dependencies
55 DepsErrors []*PackageError `json:",omitempty"` // errors loading depende ncies 55 DepsErrors []*PackageError `json:",omitempty"` // errors loading depende ncies
56 56
57 // Test information 57 // Test information
58 TestGoFiles []string `json:",omitempty"` // _test.go files in package 58 TestGoFiles []string `json:",omitempty"` // _test.go files in package
59 TestImports []string `json:",omitempty"` // imports from TestGoFiles 59 TestImports []string `json:",omitempty"` // imports from TestGoFiles
60 XTestGoFiles []string `json:",omitempty"` // _test.go files outside pack age 60 XTestGoFiles []string `json:",omitempty"` // _test.go files outside pack age
61 XTestImports []string `json:",omitempty"` // imports from XTestGoFiles 61 XTestImports []string `json:",omitempty"` // imports from XTestGoFiles
62 62
63 // Unexported fields are not part of the public API. 63 // Unexported fields are not part of the public API.
64 » build *build.Package 64 » build *build.Package
65 » pkgdir string // overrides build.PkgDir 65 » pkgdir string // overrides build.PkgDir
66 » imports []*Package 66 » imports []*Package
67 » deps []*Package 67 » deps []*Package
68 » gofiles []string // GoFiles+CgoFiles+TestGoFiles+XTestGoFiles files, absolute paths 68 » gofiles []string // GoFiles+CgoFiles+TestGoFiles+XTestGoFiles files, absolute paths
69 » target string // installed file for this package (may be executabl e) 69 » target string // installed file for this package (may be executab le)
70 » fake bool // synthesized package 70 » fake bool // synthesized package
71 » forceBuild bool // this package must be rebuilt 71 » forceBuild bool // this package must be rebuilt
72 » local bool // imported via local path (./ or ../) 72 » local bool // imported via local path (./ or ../)
73 » localPrefix string // interpret ./ and ../ imports relative to this pref ix 73 » localPrefix string // interpret ./ and ../ imports relative to this pr efix
74 } 74 }
75 75
76 func (p *Package) copyBuild(pp *build.Package) { 76 func (p *Package) copyBuild(pp *build.Package) {
77 p.build = pp 77 p.build = pp
78 78
79 p.Dir = pp.Dir 79 p.Dir = pp.Dir
80 p.ImportPath = pp.ImportPath 80 p.ImportPath = pp.ImportPath
81 p.Name = pp.Name 81 p.Name = pp.Name
82 p.Doc = pp.Doc 82 p.Doc = pp.Doc
83 p.Root = pp.Root 83 p.Root = pp.Root
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 func reusePackage(p *Package, stk *importStack) *Package { 221 func reusePackage(p *Package, stk *importStack) *Package {
222 // We use p.imports==nil to detect a package that 222 // We use p.imports==nil to detect a package that
223 // is in the midst of its own loadPackage call 223 // is in the midst of its own loadPackage call
224 // (all the recursion below happens before p.imports gets set). 224 // (all the recursion below happens before p.imports gets set).
225 if p.imports == nil { 225 if p.imports == nil {
226 if p.Error == nil { 226 if p.Error == nil {
227 p.Error = &PackageError{ 227 p.Error = &PackageError{
228 ImportStack: stk.copy(), 228 ImportStack: stk.copy(),
229 Err: "import loop", 229 Err: "import loop",
230 } 230 }
231 panic("loop")
232 } 231 }
233 p.Incomplete = true 232 p.Incomplete = true
234 } 233 }
235 if p.Error != nil && stk.shorterThan(p.Error.ImportStack) { 234 if p.Error != nil && stk.shorterThan(p.Error.ImportStack) {
236 p.Error.ImportStack = stk.copy() 235 p.Error.ImportStack = stk.copy()
237 } 236 }
238 return p 237 return p
239 } 238 }
240 239
241 // isGoTool is the list of directories for Go programs that are installed in 240 // isGoTool is the list of directories for Go programs that are installed in
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 root = filepath.Clean(root) 638 root = filepath.Clean(root)
640 if !strings.HasSuffix(root, sep) { 639 if !strings.HasSuffix(root, sep) {
641 root += sep 640 root += sep
642 } 641 }
643 dir = filepath.Clean(dir) 642 dir = filepath.Clean(dir)
644 if !strings.HasPrefix(dir, root) { 643 if !strings.HasPrefix(dir, root) {
645 return "", false 644 return "", false
646 } 645 }
647 return filepath.ToSlash(dir[len(root):]), true 646 return filepath.ToSlash(dir[len(root):]), true
648 } 647 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b