Skip to content

Commit

Permalink
feat(new): update new
Browse files Browse the repository at this point in the history
  • Loading branch information
jaronnie committed Dec 13, 2024
1 parent 429e51c commit 6c2c2ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/new/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ func (jn *JzeroNew) New(dirname string) ([]*GeneratedFile, error) {
}
fileBytes, err := templatex.ParseTemplate(jn.TemplateData, embeded.ReadTemplateFile(filepath.Join(dirname, file.Name())))
if err != nil {
return nil, errors.Wrapf(err, "parse template: %s", filepath.Join(dirname, file.Name()))
fileBytes = embeded.ReadTemplateFile(filepath.Join(dirname, file.Name()))
}

stylePath := filepath.Join(filepath.Dir(rel), filename)
if filepath.Ext(filename) == ".go" {
if filepath.Ext(filename) == ".go" && !bytes.Contains(fileBytes, []byte("DO NOT EDIT")) {
formatFilename, err := format.FileNamingFormat(jn.nc.Style, filename[0:len(filename)-len(filepath.Ext(filename))])
if err != nil {
return nil, err
Expand Down

0 comments on commit 6c2c2ce

Please sign in to comment.