Skip to content

Commit d375b2b

Browse files
authored
Merge pull request #199 from jmattheis/windows
fix: inferred package names on windows
2 parents ca8ed26 + 66518be commit d375b2b

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

.github/workflows/build.yml

+10
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

+1-1
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 {

docs/changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import GH from './GH.vue';
66

77
## unreleased
88

9+
- Fix inferred package names on windows. <GH issue="198" pr="199"/>
10+
911
## v1.8.2
1012

1113
- Fix panic when using `golang.org/x/tools` >= `v0.31.0`.

runner_test.go

+2-2
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)