MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / update

Method update

opensca/sca/java/pom.go:244–267  ·  view source on GitHub ↗

update 使用pom信息更新字符串中使用的属性 val: 更新后的字符串 ref: 更新后最终应用的属性信息

(value string)

Source from the content-addressed store, hash-verified

242// val: 更新后的字符串
243// ref: 更新后最终应用的属性信息
244func (p *Pom) update(value string) (val string, ref *Property) {
245 val = propertyReg.ReplaceAllStringFunc(value,
246 func(s string) string {
247 exist := map[string]struct{}{}
248 for strings.HasPrefix(s, "$") {
249 if _, ok := exist[s]; ok {
250 break
251 } else {
252 exist[s] = struct{}{}
253 }
254 k := s[2 : len(s)-1]
255 if v, ok := p.Properties[k]; ok {
256 if len(v.Value) > 0 {
257 s = v.Value
258 ref = v
259 continue
260 }
261 }
262 break
263 }
264 return s
265 })
266 return
267}
268
269var reg = regexp.MustCompile(`\s`)
270

Callers 1

UpdateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected