github.com/ffalor/go-swagger@v0.0.0-20231011000038-9f25265ac351/generator/bindata.go (about)

     1  package generator
     2  
     3  import (
     4  	"embed"
     5  	"io/fs"
     6  )
     7  
     8  //go:embed templates
     9  var _bindata embed.FS
    10  
    11  // AssetNames returns the names of the assets.
    12  func AssetNames() []string {
    13  	names := make([]string, 0)
    14  	_ = fs.WalkDir(_bindata, "templates", func(path string, d fs.DirEntry, err error) error {
    15  		if err != nil {
    16  			return err
    17  		}
    18  		names = append(names, path)
    19  		return nil
    20  	})
    21  	return names
    22  }
    23  
    24  // Asset loads and returns the asset for the given name.
    25  // It returns an error if the asset could not be found or
    26  // could not be loaded.
    27  func Asset(name string) ([]byte, error) {
    28  	return _bindata.ReadFile(name)
    29  }
    30  
    31  // MustAsset is like Asset but panics when Asset would return an error.
    32  // It simplifies safe initialization of global variables.
    33  func MustAsset(name string) []byte {
    34  	a, err := Asset(name)
    35  	if err != nil {
    36  		panic("asset: Asset(" + name + "): " + err.Error())
    37  	}
    38  
    39  	return a
    40  }