mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 14:48:40 +00:00
44b0c79eaf
The "all:" prefix in //go:embed directives instructs the compiler to include hidden files (starting with "." or "_") when embedding a directory. Previously, the prefix was passed literally to path.Match, which would never match. Introduce an embedPattern struct that parses and validates the pattern at construction time via newEmbedPattern(). The "all:" prefix is stripped once and stored along with the glob pattern, avoiding repeated string prefix checks. Pattern validation is absorbed into the constructor, guaranteeing that any embedPattern value is valid and eliminating the need for separate validation loops. Fixes embedding with patterns like "//go:embed all:static".