]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add ImportComment to Package struct
authorAndrew Gerrand <adg@golang.org>
Wed, 8 Oct 2014 02:22:31 +0000 (13:22 +1100)
committerAndrew Gerrand <adg@golang.org>
Wed, 8 Oct 2014 02:22:31 +0000 (13:22 +1100)
It seems reasonable that people might want to look up the
ImportComment with "go list".

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/143600043

src/cmd/go/doc.go
src/cmd/go/list.go
src/cmd/go/pkg.go

index 8e2facd0445ec48f9a165346f569560c613bd719..314c69bd8ca1739685c8fca271dc476f08146f8e 100644 (file)
@@ -385,28 +385,29 @@ syntax of package template.  The default output is equivalent to -f
 '{{.ImportPath}}'. The struct being passed to the template is:
 
     type Package struct {
-        Dir        string // directory containing package sources
-        ImportPath string // import path of package in dir
-        Name       string // package name
-        Doc        string // package documentation string
-        Target     string // install path
-        Goroot     bool   // is this package in the Go root?
-        Standard   bool   // is this package part of the standard Go library?
-        Stale      bool   // would 'go install' do anything for this package?
-        Root       string // Go root or Go path dir containing this package
+        Dir           string // directory containing package sources
+        ImportPath    string // import path of package in dir
+        ImportComment string // path in import comment on package statement
+        Name          string // package name
+        Doc           string // package documentation string
+        Target        string // install path
+        Goroot        bool   // is this package in the Go root?
+        Standard      bool   // is this package part of the standard Go library?
+        Stale         bool   // would 'go install' do anything for this package?
+        Root          string // Go root or Go path dir containing this package
 
         // Source files
-        GoFiles  []string       // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
-        CgoFiles []string       // .go sources files that import "C"
+        GoFiles        []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
+        CgoFiles       []string // .go sources files that import "C"
         IgnoredGoFiles []string // .go sources ignored due to build constraints
-        CFiles   []string       // .c source files
-        CXXFiles []string       // .cc, .cxx and .cpp source files
-        MFiles   []string       // .m source files
-        HFiles   []string       // .h, .hh, .hpp and .hxx source files
-        SFiles   []string       // .s source files
-        SwigFiles []string      // .swig files
-        SwigCXXFiles []string   // .swigcxx files
-        SysoFiles []string      // .syso object files to add to archive
+        CFiles         []string // .c source files
+        CXXFiles       []string // .cc, .cxx and .cpp source files
+        MFiles         []string // .m source files
+        HFiles         []string // .h, .hh, .hpp and .hxx source files
+        SFiles         []string // .s source files
+        SwigFiles      []string // .swig files
+        SwigCXXFiles   []string // .swigcxx files
+        SysoFiles      []string // .syso object files to add to archive
 
         // Cgo directives
         CgoCFLAGS    []string // cgo: flags for C compiler
index 0ead4350238231d8b41fc3be12ce9fcae1abaea3..fbf96167febd47f0c9b226010efe444189429921 100644 (file)
@@ -30,28 +30,29 @@ syntax of package template.  The default output is equivalent to -f
 '{{.ImportPath}}'. The struct being passed to the template is:
 
     type Package struct {
-        Dir        string // directory containing package sources
-        ImportPath string // import path of package in dir
-        Name       string // package name
-        Doc        string // package documentation string
-        Target     string // install path
-        Goroot     bool   // is this package in the Go root?
-        Standard   bool   // is this package part of the standard Go library?
-        Stale      bool   // would 'go install' do anything for this package?
-        Root       string // Go root or Go path dir containing this package
+        Dir           string // directory containing package sources
+        ImportPath    string // import path of package in dir
+        ImportComment string // path in import comment on package statement
+        Name          string // package name
+        Doc           string // package documentation string
+        Target        string // install path
+        Goroot        bool   // is this package in the Go root?
+        Standard      bool   // is this package part of the standard Go library?
+        Stale         bool   // would 'go install' do anything for this package?
+        Root          string // Go root or Go path dir containing this package
 
         // Source files
-        GoFiles  []string       // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
-        CgoFiles []string       // .go sources files that import "C"
+        GoFiles        []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
+        CgoFiles       []string // .go sources files that import "C"
         IgnoredGoFiles []string // .go sources ignored due to build constraints
-        CFiles   []string       // .c source files
-        CXXFiles []string       // .cc, .cxx and .cpp source files
-        MFiles   []string       // .m source files
-        HFiles   []string       // .h, .hh, .hpp and .hxx source files
-        SFiles   []string       // .s source files
-        SwigFiles []string      // .swig files
-        SwigCXXFiles []string   // .swigcxx files
-        SysoFiles []string      // .syso object files to add to archive
+        CFiles         []string // .c source files
+        CXXFiles       []string // .cc, .cxx and .cpp source files
+        MFiles         []string // .m source files
+        HFiles         []string // .h, .hh, .hpp and .hxx source files
+        SFiles         []string // .s source files
+        SwigFiles      []string // .swig files
+        SwigCXXFiles   []string // .swigcxx files
+        SysoFiles      []string // .syso object files to add to archive
 
         // Cgo directives
         CgoCFLAGS    []string // cgo: flags for C compiler
index 7f7a3b04fd7bddeb66fbf41bf3ff3519661ca902..e17326442c9ec8fb82a24243209e4ad29baab871 100644 (file)
@@ -26,16 +26,17 @@ type Package struct {
        // Note: These fields are part of the go command's public API.
        // See list.go.  It is okay to add fields, but not to change or
        // remove existing ones.  Keep in sync with list.go
-       Dir         string `json:",omitempty"` // directory containing package sources
-       ImportPath  string `json:",omitempty"` // import path of package in dir
-       Name        string `json:",omitempty"` // package name
-       Doc         string `json:",omitempty"` // package documentation string
-       Target      string `json:",omitempty"` // install path
-       Goroot      bool   `json:",omitempty"` // is this package found in the Go root?
-       Standard    bool   `json:",omitempty"` // is this package part of the standard Go library?
-       Stale       bool   `json:",omitempty"` // would 'go install' do anything for this package?
-       Root        string `json:",omitempty"` // Go root or Go path dir containing this package
-       ConflictDir string `json:",omitempty"` // Dir is hidden by this other directory
+       Dir           string `json:",omitempty"` // directory containing package sources
+       ImportPath    string `json:",omitempty"` // import path of package in dir
+       ImportComment string `json:",omitempty"` // path in import comment on package statement
+       Name          string `json:",omitempty"` // package name
+       Doc           string `json:",omitempty"` // package documentation string
+       Target        string `json:",omitempty"` // install path
+       Goroot        bool   `json:",omitempty"` // is this package found in the Go root?
+       Standard      bool   `json:",omitempty"` // is this package part of the standard Go library?
+       Stale         bool   `json:",omitempty"` // would 'go install' do anything for this package?
+       Root          string `json:",omitempty"` // Go root or Go path dir containing this package
+       ConflictDir   string `json:",omitempty"` // Dir is hidden by this other directory
 
        // Source files
        GoFiles        []string `json:",omitempty"` // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
@@ -104,6 +105,7 @@ func (p *Package) copyBuild(pp *build.Package) {
 
        p.Dir = pp.Dir
        p.ImportPath = pp.ImportPath
+       p.ImportComment = pp.ImportComment
        p.Name = pp.Name
        p.Doc = pp.Doc
        p.Root = pp.Root