Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
cmd/cue/cmd: convert package block comments in cue get go
Browse files Browse the repository at this point in the history
Pass package comments through writeDoc.

Issue #173

Change-Id: Ib0438ed38012bcb15128d1315b654111285753d9
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4140
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Nov 24, 2019
1 parent c6e5d17 commit d372ba8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions cmd/cue/cmd/get_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,7 @@ func (e *extractor) extractPkg(root string, p *packages.Package) error {
fmt.Fprintln(w, "//cue:generate cue get go", args)
fmt.Fprintln(w)
if f.Doc != nil {
for _, c := range f.Doc.List {
fmt.Fprintln(w, c.Text)
}
writeDoc(w, f.Doc)
}
fmt.Fprintf(w, "package %s\n", p.Name)
fmt.Fprintln(w)
Expand Down
3 changes: 3 additions & 0 deletions cmd/cue/cmd/testdata/code/go/pkg1/file1.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/*
block comment
*/
package pkg1

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

//cue:generate cue get go cuelang.org/go/cmd/cue/cmd/testdata/code/go/pkg1

// block comment
package pkg1

import (
Expand Down

0 comments on commit d372ba8

Please sign in to comment.