Skip to content

Commit

Permalink
fix: only continue when fileNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
yyy1000 committed May 1, 2023
1 parent 8d67388 commit b952b9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/plugins/golang/v4/scaffolds/api.go
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 {
boilerplate = []byte("")
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 b952b9b

Please sign in to comment.