fix(templates): usa path.Join para acessar manifestos embutidos (corrige Windows) - #207
Open
noskcaj21 wants to merge 1 commit into
Open
fix(templates): usa path.Join para acessar manifestos embutidos (corrige Windows)#207noskcaj21 wants to merge 1 commit into
noskcaj21 wants to merge 1 commit into
Conversation
…Windows) O acesso aos manifestos embutidos via go:embed usava filepath.Join, que no Windows gera separador "\" (ex.: manifests\defaultDeployment.yaml). Porém a embed.FS/io/fs sempre usa "/" como separador, independente do sistema operacional. Isso fazia GetManifest falhar no Windows com "file does not exist", quebrando `girus create cluster` (deploy) e o carregamento de labs. No Linux/macOS filepath.Join usa "/" e por isso o bug nao aparecia. Troca filepath.Join por path.Join (que sempre usa "/") no acesso a embed.FS. Testado no Windows 11: `girus create cluster` implanta o backend/frontend e `girus list labs` passa a funcionar. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
No Windows,
girus create clustercria o cluster Kind mas falha ao implantar o Girus com:O mesmo afeta o carregamento de laboratórios (
GetManifest).Causa
Em
internal/templates/templates.go, o acesso aos manifestos embutidos (go:embed) usafilepath.Join:filepath.Joinusa o separador do SO — no Windows geramanifests\defaultDeployment.yaml(barra invertida). Masembed.FS/io/fssempre usam/como separador, independente do sistema operacional (docio/fs). Assim, no Windows ofs.ReadFilerecebe um caminho inválido e retorna "file does not exist", mesmo com o arquivo embutido no binário.No Linux/macOS
filepath.Joinjá usa/, por isso o bug não aparece nessas plataformas.Correção
Trocar
filepath.Joinporpath.Join(que sempre usa/) no acesso àembed.FS. Os demais usos defilepath.Joinno projeto operam sobre o filesystem real do SO e foram mantidos.Teste
Testado no Windows 11 com o binário recompilado:
girus create cluster→ implanta backend + frontend com sucesso (podsRunning)girus list labs→ lista os laboratórios normalmentepath.Joinefilepath.Joinproduzem/lá)Mudança de 1 linha (+ import
pathe um comentário).