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

make lint happy

This commit is contained in:
源文雨
2023-02-23 14:34:44 +08:00
parent 59cce024f7
commit fa053fefd4
13 changed files with 350 additions and 170 deletions

12
link.go
View File

@@ -17,14 +17,14 @@ var (
//
// this func is not thread-safe
func (f *Docx) addLinkRelation(link string) string {
rel := &Relationship{
rel := Relationship{
ID: "rId" + strconv.Itoa(int(atomic.AddUintptr(&f.rId, 1))),
Type: REL_HYPERLINK,
Target: link,
TargetMode: REL_TARGETMODE,
}
f.DocRelation.Relationships = append(f.DocRelation.Relationships, rel)
f.DocRelation.Relationship = append(f.DocRelation.Relationship, rel)
return rel.ID
}
@@ -33,13 +33,13 @@ func (f *Docx) addLinkRelation(link string) string {
//
// this func is not thread-safe
func (f *Docx) addImageRelation(m Media) string {
rel := &Relationship{
rel := Relationship{
ID: "rId" + strconv.Itoa(int(atomic.AddUintptr(&f.rId, 1))),
Type: REL_IMAGE,
Target: "media/" + m.Name,
}
f.DocRelation.Relationships = append(f.DocRelation.Relationships, rel)
f.DocRelation.Relationship = append(f.DocRelation.Relationship, rel)
return rel.ID
}
@@ -48,7 +48,7 @@ func (f *Docx) addImageRelation(m Media) string {
func (f *Docx) ReferTarget(id string) (string, error) {
f.DocRelation.mu.RLock()
defer f.DocRelation.mu.RUnlock()
for _, a := range f.DocRelation.Relationships {
for _, a := range f.DocRelation.Relationship {
if a.ID == id {
return a.Target, nil
}
@@ -60,7 +60,7 @@ func (f *Docx) ReferTarget(id string) (string, error) {
func (f *Docx) ReferID(target string) (string, error) {
f.DocRelation.mu.RLock()
defer f.DocRelation.mu.RUnlock()
for _, a := range f.DocRelation.Relationships {
for _, a := range f.DocRelation.Relationship {
if a.Target == target {
return a.ID, nil
}