1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-09 17:50:27 +08:00

refactor: Run use Children

This commit is contained in:
源文雨
2023-02-25 21:18:29 +08:00
parent e32b907c6a
commit fafd4c9fc3
14 changed files with 101 additions and 129 deletions

View File

@@ -66,8 +66,6 @@ func (f *Docx) addImageRelation(m Media) string {
// ReferTarget gets the target for a reference
func (f *Docx) ReferTarget(id string) (string, error) {
f.docRelation.mu.RLock()
defer f.docRelation.mu.RUnlock()
for _, a := range f.docRelation.Relationship {
if a.ID == id {
return a.Target, nil
@@ -78,8 +76,6 @@ func (f *Docx) ReferTarget(id string) (string, error) {
// ReferID gets the rId from target
func (f *Docx) ReferID(target string) (string, error) {
f.docRelation.mu.RLock()
defer f.docRelation.mu.RUnlock()
for _, a := range f.docRelation.Relationship {
if a.Target == target {
return a.ID, nil