github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/assets_embedded.go (about)

     1  //go:build embedassets
     2  // +build embedassets
     3  
     4  package webapp
     5  
     6  import (
     7  	"embed"
     8  	"io/fs"
     9  	"net/http"
    10  )
    11  
    12  var AssetsEmbedded = true
    13  
    14  //go:embed public
    15  var assets embed.FS
    16  
    17  func Assets() (http.FileSystem, error) {
    18  	fsys, err := fs.Sub(assets, "public")
    19  
    20  	if err != nil {
    21  		return nil, err
    22  	}
    23  
    24  	return http.FS(fsys), nil
    25  }