Skip to content

Commit

Permalink
Add error message when specifying path in package name
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathew Byrne committed Jul 9, 2018
1 parent c8355f4 commit ebf1b2a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions codegen/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,21 @@ func (c *PackageConfig) Dir() string {
return filepath.ToSlash(filepath.Dir(c.Filename))
}

func (c *PackageConfig) Check() error {
if strings.ContainsAny(c.Package, "./") {
return fmt.Errorf("package should be the output package name only, do not include the output filename")
}
return nil
}

func (cfg *Config) Check() error {
err := cfg.Models.Check()
if err != nil {
if err := cfg.Models.Check(); err != nil {
return fmt.Errorf("config: %s", err.Error())
}
if err := cfg.Exec.Check(); err != nil {
return fmt.Errorf("config: %s", err.Error())
}
if err := cfg.Model.Check(); err != nil {
return fmt.Errorf("config: %s", err.Error())
}
return nil
Expand Down

0 comments on commit ebf1b2a

Please sign in to comment.