Skip to content

Commit 9af6ca4

Browse files
authored
Merge pull request #3378 from yyy1000/dev
🐛 (go/v4): Scaffold when no boilerplate file
2 parents fd4b088 + b952b9b commit 9af6ca4

File tree

1 file changed

+6
-1
lines changed
  • pkg/plugins/golang/v4/scaffolds

1 file changed

+6
-1
lines changed

pkg/plugins/golang/v4/scaffolds/api.go

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package scaffolds
1818

1919
import (
20+
"errors"
2021
"fmt"
2122

2223
"github.com/spf13/afero"
@@ -67,7 +68,11 @@ func (s *apiScaffolder) Scaffold() error {
6768
// Load the boilerplate
6869
boilerplate, err := afero.ReadFile(s.fs.FS, hack.DefaultBoilerplatePath)
6970
if err != nil {
70-
return fmt.Errorf("error scaffolding API/controller: unable to load boilerplate: %w", err)
71+
if errors.Is(err, afero.ErrFileNotFound) {
72+
boilerplate = []byte("")
73+
} else {
74+
return fmt.Errorf("error scaffolding API/controller: unable to load boilerplate: %w", err)
75+
}
7176
}
7277

7378
// Initialize the machinery.Scaffold that will write the files to disk

0 commit comments

Comments
 (0)