Skip to content

Commit

Permalink
Treat nested paths for struct:pkg:path Meta
Browse files Browse the repository at this point in the history
  • Loading branch information
tchssk authored and raphael committed Jan 28, 2024
1 parent a225080 commit 2738b8d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion codegen/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package codegen

import (
"fmt"
"path/filepath"
"strconv"
"strings"

Expand Down Expand Up @@ -100,7 +101,7 @@ func (s *NameScope) GoTypeDef(att *expr.AttributeExpr, ptr, useDefault bool) str
if loc := UserTypeLocation(att.Type); loc != nil {
pkg = loc.PackageName()
} else if p, ok := att.Meta.Last("struct:pkg:path"); ok && p != "" {
pkg = p
pkg = Goify(filepath.Base(p), false)
}
return s.goTypeDef(att, ptr, useDefault, pkg)
}
Expand Down

0 comments on commit 2738b8d

Please sign in to comment.