pkgWithDefault returns the package defining the given type. If the types is a user type with "struct:pkg:path" metadata then it returns the corresponding value, otherwise it returns pkg.
(dt expr.DataType, pkg string)
| 346 | // user type with "struct:pkg:path" metadata then it returns the corresponding |
| 347 | // value, otherwise it returns pkg. |
| 348 | func pkgWithDefault(dt expr.DataType, pkg string) string { |
| 349 | if loc := UserTypeLocation(dt); loc != nil { |
| 350 | return loc.PackageName() |
| 351 | } |
| 352 | return pkg |
| 353 | } |
| 354 | |
| 355 | func goTypeRef(name string, dt expr.DataType) string { |
| 356 | // For a raw struct, no need to dereference |
no test coverage detected