Skip to content

Commit

Permalink
Do not allow '-' character in golang package names
Browse files Browse the repository at this point in the history
Addressing:
// Models for http://oval.mitre.org/XMLSchema/oval-definitions-5#aix
package aix-def
  • Loading branch information
isimluk committed May 26, 2020
1 parent bc972e7 commit 22d4c68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/xsd/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"path/filepath"
"strings"
)

// Schema is the root XSD element
Expand Down Expand Up @@ -121,7 +122,8 @@ func (sch *Schema) GetElement(name string) *Element {
}

func (sch *Schema) GoPackageName() string {
return sch.Xmlns.PrefixByUri(sch.TargetNamespace)
xmlnsPrefix := sch.Xmlns.PrefixByUri(sch.TargetNamespace)
return strings.ReplaceAll(xmlnsPrefix, "-", "_")
}

func (sch *Schema) GoImportsNeeded() []string {
Expand Down

0 comments on commit 22d4c68

Please # to comment.