Skip to content

Commit

Permalink
fix gen_test.go (#960)
Browse files Browse the repository at this point in the history
* fix gen_test.go

* remove invalid condition from gen.go
  • Loading branch information
ubogdan authored Jul 27, 2021
1 parent c71655d commit 0ab714a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ type Config struct {
// Build builds swagger json file for given searchDir and mainAPIFile. Returns json
func (g *Gen) Build(config *Config) error {
searchDirs := strings.Split(config.SearchDir, ",")
if len(searchDirs) == 0 {
return fmt.Errorf("empty searching dir: %s", config.SearchDir)
}
for _, searchDir := range searchDirs {
if _, err := os.Stat(searchDir); os.IsNotExist(err) {
return fmt.Errorf("dir: %s does not exist", searchDir)
Expand Down
2 changes: 1 addition & 1 deletion gen/gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestGen_SearchDirIsNotExist(t *testing.T) {
OutputDir: swaggerConfDir,
PropNamingStrategy: propNamingStrategy,
}
assert.EqualError(t, New().Build(config), "dir: ../isNotExistDir is not exist")
assert.EqualError(t, New().Build(config), "dir: ../isNotExistDir does not exist")
}

func TestGen_MainAPiNotExist(t *testing.T) {
Expand Down

0 comments on commit 0ab714a

Please sign in to comment.