Skip to content

Conversation

@Alireza-Gholiei
Copy link
Contributor

Summary

This PR fixes an issue where templates embedded with //go:embed couldn't be opened on Windows because paths were constructed with filepath.Join which produces backslashes (e.g. block\letsencrypt.conf). embed.FS expects forward slashes.

Changes

  • Rename function parameter path -> dir in:
    • GetTemplateInfo
    • ParseTemplate
  • Use path.Join(dir, name) instead of filepath.Join(...)
  • Replace import "path/filepath" with import "path" where appropriate.

Why

  • embed.FS normalizes file names with forward slashes (/). On Windows filepath.Join produces backslashes which lead to "file does not exist" errors at runtime.
  • The change preserves cross-platform behavior: path.Join works on Linux/macOS and Windows for embedded resources.
@0xJacky
Copy link
Owner

0xJacky commented Oct 16, 2025

Thanks

@0xJacky 0xJacky merged commit a6e1691 into 0xJacky:dev Oct 16, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants