MCPcopy Create free account
hub / github.com/wailsapp/wails / GetEmbedDetailsForFile

Function GetEmbedDetailsForFile

v2/internal/staticanalysis/staticanalysis.go:49–84  ·  view source on GitHub ↗
(file *ast.File, baseDir string)

Source from the content-addressed store, hash-verified

47}
48
49func GetEmbedDetailsForFile(file *ast.File, baseDir string) []*EmbedDetails {
50 var result []*EmbedDetails
51 for _, comment := range file.Comments {
52 for _, c := range comment.List {
53 if strings.HasPrefix(c.Text, "//go:embed") {
54 sl := strings.Split(c.Text, " ")
55 if len(sl) == 1 {
56 continue
57 }
58 // support for multiple paths in one comment
59 for _, arg := range sl[1:] {
60 embedPath := strings.TrimSpace(arg)
61 // ignores all pattern matching characters except escape sequence
62 if strings.Contains(embedPath, "*") || strings.Contains(embedPath, "?") || strings.Contains(embedPath, "[") {
63 continue
64 }
65 if strings.HasPrefix(embedPath, "all:") {
66 result = append(result, &EmbedDetails{
67 EmbedPath: strings.TrimPrefix(embedPath, "all:"),
68 All: true,
69 BaseDir: baseDir,
70 })
71 } else {
72 result = append(result, &EmbedDetails{
73 EmbedPath: embedPath,
74 All: false,
75 BaseDir: baseDir,
76 })
77 }
78
79 }
80 }
81 }
82 }
83 return result
84}

Callers 1

GetEmbedDetailsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…