Skip to content

Commit

Permalink
Always use slashed for file path Fixes hashicorp#104
Browse files Browse the repository at this point in the history
  • Loading branch information
hmalphettes committed Apr 16, 2022
1 parent 846f954 commit 41919d4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/packer-sdc/internal/struct-markdown/struct_markdown.go
Expand Up @@ -80,6 +80,8 @@ func (cmd *Command) Run(args []string) int {
log.Fatalf("ParseFile: %+v", err)
}

canonicalFilePath := filepath.ToSlash(filePath)

for _, decl := range f.Decls {
typeDecl, ok := decl.(*ast.GenDecl)
if !ok {
Expand All @@ -96,23 +98,23 @@ func (cmd *Command) Run(args []string) int {

fields := structDecl.Fields.List
header := Struct{
SourcePath: filePath,
SourcePath: canonicalFilePath,
Name: typeSpec.Name.Name,
Filename: typeSpec.Name.Name + ".mdx",
Header: strings.TrimSpace(typeDecl.Doc.Text()),
}
dataSourceOutput := Struct{
SourcePath: filePath,
SourcePath: canonicalFilePath,
Name: typeSpec.Name.Name,
Filename: typeSpec.Name.Name + ".mdx",
}
required := Struct{
SourcePath: filePath,
SourcePath: canonicalFilePath,
Name: typeSpec.Name.Name,
Filename: typeSpec.Name.Name + "-required.mdx",
}
notRequired := Struct{
SourcePath: filePath,
SourcePath: canonicalFilePath,
Name: typeSpec.Name.Name,
Filename: typeSpec.Name.Name + "-not-required.mdx",
}
Expand Down

0 comments on commit 41919d4

Please sign in to comment.