Skip to content

Commit

Permalink
Merge pull request #3378 from yyy1000/dev
Browse files Browse the repository at this point in the history
🐛 (go/v4): Scaffold when no boilerplate file
  • Loading branch information
k8s-ci-robot committed May 2, 2023
2 parents fd4b088 + b952b9b commit 9af6ca4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/plugins/golang/v4/scaffolds/api.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package scaffolds

import (
"errors"
"fmt"

"github.com/spf13/afero"
Expand Down Expand Up @@ -67,7 +68,11 @@ func (s *apiScaffolder) Scaffold() error {
// Load the boilerplate
boilerplate, err := afero.ReadFile(s.fs.FS, hack.DefaultBoilerplatePath)
if err != nil {
return fmt.Errorf("error scaffolding API/controller: unable to load boilerplate: %w", err)
if errors.Is(err, afero.ErrFileNotFound) {
boilerplate = []byte("")
} else {
return fmt.Errorf("error scaffolding API/controller: unable to load boilerplate: %w", err)
}
}

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

0 comments on commit 9af6ca4

Please sign in to comment.