mirror of https://github.com/databricks/cli.git
use errors is
This commit is contained in:
parent
9a70861e4b
commit
ecc07e893f
|
@ -1,6 +1,7 @@
|
||||||
package template
|
package template
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -41,10 +42,7 @@ func generateDirectory(config map[string]any, parentDir, nameTempate string) (st
|
||||||
func generateFile(config map[string]any, parentDir, nameTempate, contentTemplate string) error {
|
func generateFile(config map[string]any, parentDir, nameTempate, contentTemplate string) error {
|
||||||
// compute file content
|
// compute file content
|
||||||
fileContent, err := executeTemplate(config, contentTemplate)
|
fileContent, err := executeTemplate(config, contentTemplate)
|
||||||
// We do a substring match here because on errors the template library prepends
|
if errors.Is(err, ErrSkipThisFile) {
|
||||||
// some additional information about the callsite from which the ErrSkipThisFile
|
|
||||||
// error was returned
|
|
||||||
if err != nil && strings.Contains(err.Error(), ErrSkipThisFile.Error()) {
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue