Build fix.

This commit is contained in:
go-jet 2019-07-04 14:42:50 +02:00
parent 471bddcaf5
commit f34c5e7fe8
2 changed files with 10 additions and 9 deletions

View file

@ -28,10 +28,9 @@ jobs:
command: | command: |
go get github.com/google/uuid go get github.com/google/uuid
go get github.com/lib/pq go get github.com/lib/pq
go get github.com/pkg/profile go get github.com/pkg/profile
go get gotest.tools/assert go get gotest.tools/assert
go get github.com/onsi/ginkgo
go get github.com/onsi/gomega
go get github.com/davecgh/go-spew/spew go get github.com/davecgh/go-spew/spew
go get github.com/jstemmer/go-junit-report go get github.com/jstemmer/go-junit-report

View file

@ -9,15 +9,17 @@ func ToGoIdentifier(databaseIdentifier string) string {
if len(databaseIdentifier) == 0 { if len(databaseIdentifier) == 0 {
return databaseIdentifier return databaseIdentifier
} }
databaseIdentifier = strings.ReplaceAll(databaseIdentifier, " ", "_")
databaseIdentifier = strings.ReplaceAll(databaseIdentifier, "-", "_")
return snaker.SnakeToCamel(databaseIdentifier) return snaker.SnakeToCamel(replaceInvalidChars(databaseIdentifier))
} }
func ToGoFileName(databaseIdentifier string) string { func ToGoFileName(databaseIdentifier string) string {
databaseIdentifier = strings.ReplaceAll(databaseIdentifier, " ", "_") return strings.ToLower(replaceInvalidChars(databaseIdentifier))
databaseIdentifier = strings.ReplaceAll(databaseIdentifier, "-", "_") }
return strings.ToLower(databaseIdentifier) func replaceInvalidChars(str string) string {
str = strings.Replace(str, " ", "_", -1)
str = strings.Replace(str, "-", "_", -1)
return str
} }