Skip to content

Commit

Permalink
fix: Replace each backslash in path with a slash (#825)
Browse files Browse the repository at this point in the history
* fix: Replace each backslash in path with a slash

* Update gg.S() call
  • Loading branch information
JinnyYi authored Sep 26, 2021
1 parent fbc4b59 commit 4956683
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cmd/definitions/gen_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func generateSrv(data *Service, path string) {
f.AddPackage(data.Name)
f.NewImport().
AddPath("context").
AddPath("path/filepath").
AddPath("io").
AddPath("net/http").
AddPath("strings").
AddPath("time").
AddLine().
AddDot("github.com/beyondstorage/go-storage/v4/pairs").
Expand Down Expand Up @@ -529,7 +529,7 @@ If user enable this feature, service should ignore not support pair error.`),
continue
}
if v.Name == "path" || v.Name == "src" || v.Name == "dst" || v.Name == "target" {
ic.AddParameter(gg.S("filepath.ToSlash(%s)", v.Name))
ic.AddParameter(gg.S(`strings.ReplaceAll(%s, "\\", "/")`, v.Name))
continue
}
ic.AddParameter(v.Name)
Expand Down
24 changes: 12 additions & 12 deletions tests/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4956683

Please sign in to comment.