Commit fdc047fb authored by Andrew Gerrand's avatar Andrew Gerrand

cmd/go: add ImportComment to Package struct

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