Skip to content

Commit

Permalink
feature: using standard generated files comment
Browse files Browse the repository at this point in the history
  • Loading branch information
OhYee committed Oct 10, 2019
1 parent 54fb50a commit 157077b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion example/compare/compare.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/compare/g.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package compare

//go:generate echo generate compare package
//go:generate gcg data.json
//go:generate gcg ./data.json

func otherCodeOfThePackage(){}
4 changes: 2 additions & 2 deletions gcg.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

const (
version = "0.0.5"
version = "0.0.6"
helpText = "Using `gcg <json file>` to generate go file\nSuch as `gcg data.json`"
)

Expand Down Expand Up @@ -219,7 +219,7 @@ func renderTemplate(buf io.Writer, templates []string, args []interface{}, varia

// renderContent render generated file content
func renderContent(cfg config, gf goFile) {
buf := bytes.NewBufferString("// generated by Go Code Generator(https://github.com/OhYee/gcg); DO NOT EDIT\n\n")
buf := bytes.NewBufferString(fmt.Sprintf("// Code generated by GCG. DO NOT EDIT.\n// Go Code Generator %v (https://github.com/OhYee/gcg)\n\n", version))
buf.WriteString(fmt.Sprintf("package %s\n\n", gf.PackageName))
buf.WriteString(fmt.Sprintf("import (\n%s\n)\n\n",
func(slice []interface{}) string {
Expand Down

0 comments on commit 157077b

Please sign in to comment.