Closed koddr closed 4 years ago
That’s not a bug. That’s expected. Pkger uses static analysis tools to figure out what it includes. Static analysis can’t determine dynamic values, only static ones, like hard coded strings.
-- Mark Bates
On Dec 31, 2019, at 7:00 AM, Vic Shóstak notifications@github.com wrote:
Hi!
I catch strange bug: if I specify name arg on pkger.Include() by var (or const), it folder/file is not accepted (e.g. not embed to binary). For example:
package main
import ( "github.com/markbates/pkger" )
var ( configFolder string = "/configs" )
// OR: // // const ( // configFolder string = "/configs" // )
func main() { // Embed ./configs folder pkger.Include(configFolder)
// ... But, if I specify name as simple string, like pkger.Include("/configs"), all okay. What I miss? Help to understand please.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
@markbates if a string is defined as const
its value could be determined by a static analysis, as it cannot change at runtime, therefore this issue should still be opened.
Hi!
I catch strange bug: if I specify
name
arg onpkger.Include()
byvar
(orconst
), it folder/file is not accepted (e.g. not embed to binary). For example:But, if I specify name as simple string, like
pkger.Include("/configs")
, all okay. What I miss? Help to understand please.