MCPcopy Create free account
hub / github.com/goadesign/goa / pkgWithDefault

Function pkgWithDefault

codegen/scope.go:348–353  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

GoFullTypeNameMethod · 0.70

Calls 2

UserTypeLocationFunction · 0.85
PackageNameMethod · 0.80

Tested by

no test coverage detected