Skip to content

Commit b61d521

Browse files
committed
fix: inferred package names on windows
1 parent ca8ed26 commit b61d521

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ jobs:
1313
- uses: golangci/golangci-lint-action@v3
1414
with:
1515
version: v1.64.4
16+
test_windows:
17+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name)
18+
runs-on: windows-latest
19+
steps:
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version: 1.24.x
23+
- uses: actions/checkout@v4
24+
- run: go build ./cmd/goverter
25+
- run: go test ./...
1626
test:
1727
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name)
1828
runs-on: ubuntu-latest

config/package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func resolvePackage(sourceFileName, sourcePackage, targetFile string) (string, e
1818
}
1919
}
2020

21-
return filepath.Dir(filepath.Join(sourcePackage, relativeFile)), nil
21+
return filepath.ToSlash(filepath.Dir(filepath.Join(sourcePackage, relativeFile))), nil
2222
}
2323

2424
func getPackages(raw *Raw) []string {

runner_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func TestScenario(t *testing.T) {
118118
}
119119

120120
func replaceAbsolutePath(curPath, body string) string {
121-
return strings.ReplaceAll(body, curPath, "@workdir")
121+
return filepath.ToSlash(strings.ReplaceAll(body, curPath, "@workdir"))
122122
}
123123

124124
func compile(dir string) error {
@@ -140,7 +140,7 @@ func toOutputFiles(execDir string, files map[string][]byte) []*OutputFile {
140140
if err != nil {
141141
panic("could not create relpath")
142142
}
143-
output = append(output, &OutputFile{Name: rel, Content: string(content)})
143+
output = append(output, &OutputFile{Name: filepath.ToSlash(rel), Content: string(content)})
144144
}
145145
sort.Slice(output, func(i, j int) bool {
146146
return output[i].Name < output[j].Name

0 commit comments

Comments
 (0)