How to use Run method of main Package

Best Syzkaller code snippet using main.Run

CT_BdoContentRun.go

Source:CT_BdoContentRun.go Github

copy

Full Screen

...12 "fmt"13 "baliance.com/gooxml"14 "baliance.com/gooxml/schema/soo/ofc/math"15)16type CT_BdoContentRun struct {17 // Direction of Override18 ValAttr ST_Direction19 // Simple Field20 FldSimple []*CT_SimpleField21 // Hyperlink22 Hyperlink *CT_Hyperlink23 // Anchor for Subdocument Location24 SubDoc *CT_Rel25 EG_ContentRunContent []*EG_ContentRunContent26}27func NewCT_BdoContentRun() *CT_BdoContentRun {28 ret := &CT_BdoContentRun{}29 return ret30}31func (m *CT_BdoContentRun) MarshalXML(e *xml.Encoder, start xml.StartElement) error {32 if m.ValAttr != ST_DirectionUnset {33 attr, err := m.ValAttr.MarshalXMLAttr(xml.Name{Local: "w:val"})34 if err != nil {35 return err36 }37 start.Attr = append(start.Attr, attr)38 }39 e.EncodeToken(start)40 if m.FldSimple != nil {41 sefldSimple := xml.StartElement{Name: xml.Name{Local: "w:fldSimple"}}42 for _, c := range m.FldSimple {43 e.EncodeElement(c, sefldSimple)44 }45 }46 if m.Hyperlink != nil {47 sehyperlink := xml.StartElement{Name: xml.Name{Local: "w:hyperlink"}}48 e.EncodeElement(m.Hyperlink, sehyperlink)49 }50 if m.SubDoc != nil {51 sesubDoc := xml.StartElement{Name: xml.Name{Local: "w:subDoc"}}52 e.EncodeElement(m.SubDoc, sesubDoc)53 }54 if m.EG_ContentRunContent != nil {55 for _, c := range m.EG_ContentRunContent {56 c.MarshalXML(e, xml.StartElement{})57 }58 }59 e.EncodeToken(xml.EndElement{Name: start.Name})60 return nil61}62func (m *CT_BdoContentRun) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {63 // initialize to default64 for _, attr := range start.Attr {65 if attr.Name.Local == "val" {66 m.ValAttr.UnmarshalXMLAttr(attr)67 continue68 }69 }70lCT_BdoContentRun:71 for {72 tok, err := d.Token()73 if err != nil {74 return err75 }76 switch el := tok.(type) {77 case xml.StartElement:78 switch el.Name {79 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "fldSimple"}:80 tmp := NewCT_SimpleField()81 if err := d.DecodeElement(tmp, &el); err != nil {82 return err83 }84 m.FldSimple = append(m.FldSimple, tmp)85 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "hyperlink"}:86 m.Hyperlink = NewCT_Hyperlink()87 if err := d.DecodeElement(m.Hyperlink, &el); err != nil {88 return err89 }90 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "subDoc"}:91 m.SubDoc = NewCT_Rel()92 if err := d.DecodeElement(m.SubDoc, &el); err != nil {93 return err94 }95 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXml"}:96 tmpcontentruncontent := NewEG_ContentRunContent()97 tmpcontentruncontent.CustomXml = NewCT_CustomXmlRun()98 if err := d.DecodeElement(tmpcontentruncontent.CustomXml, &el); err != nil {99 return err100 }101 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)102 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "smartTag"}:103 tmpcontentruncontent := NewEG_ContentRunContent()104 tmpcontentruncontent.SmartTag = NewCT_SmartTagRun()105 if err := d.DecodeElement(tmpcontentruncontent.SmartTag, &el); err != nil {106 return err107 }108 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)109 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "sdt"}:110 tmpcontentruncontent := NewEG_ContentRunContent()111 tmpcontentruncontent.Sdt = NewCT_SdtRun()112 if err := d.DecodeElement(tmpcontentruncontent.Sdt, &el); err != nil {113 return err114 }115 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)116 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dir"}:117 tmpcontentruncontent := NewEG_ContentRunContent()118 tmpcontentruncontent.Dir = NewCT_DirContentRun()119 if err := d.DecodeElement(tmpcontentruncontent.Dir, &el); err != nil {120 return err121 }122 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)123 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bdo"}:124 tmpcontentruncontent := NewEG_ContentRunContent()125 tmpcontentruncontent.Bdo = NewCT_BdoContentRun()126 if err := d.DecodeElement(tmpcontentruncontent.Bdo, &el); err != nil {127 return err128 }129 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)130 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "r"}:131 tmpcontentruncontent := NewEG_ContentRunContent()132 tmpcontentruncontent.R = NewCT_R()133 if err := d.DecodeElement(tmpcontentruncontent.R, &el); err != nil {134 return err135 }136 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)137 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "proofErr"}:138 tmpcontentruncontent := NewEG_ContentRunContent()139 tmprunlevelelts := NewEG_RunLevelElts()140 tmprunlevelelts.ProofErr = NewCT_ProofErr()141 if err := d.DecodeElement(tmprunlevelelts.ProofErr, &el); err != nil {142 return err143 }144 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)145 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)146 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "permStart"}:147 tmpcontentruncontent := NewEG_ContentRunContent()148 tmprunlevelelts := NewEG_RunLevelElts()149 tmprunlevelelts.PermStart = NewCT_PermStart()150 if err := d.DecodeElement(tmprunlevelelts.PermStart, &el); err != nil {151 return err152 }153 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)154 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)155 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "permEnd"}:156 tmpcontentruncontent := NewEG_ContentRunContent()157 tmprunlevelelts := NewEG_RunLevelElts()158 tmprunlevelelts.PermEnd = NewCT_Perm()159 if err := d.DecodeElement(tmprunlevelelts.PermEnd, &el); err != nil {160 return err161 }162 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)163 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)164 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "ins"}:165 tmpcontentruncontent := NewEG_ContentRunContent()166 tmprunlevelelts := NewEG_RunLevelElts()167 tmprunlevelelts.Ins = NewCT_RunTrackChange()168 if err := d.DecodeElement(tmprunlevelelts.Ins, &el); err != nil {169 return err170 }171 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)172 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)173 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "del"}:174 tmpcontentruncontent := NewEG_ContentRunContent()175 tmprunlevelelts := NewEG_RunLevelElts()176 tmprunlevelelts.Del = NewCT_RunTrackChange()177 if err := d.DecodeElement(tmprunlevelelts.Del, &el); err != nil {178 return err179 }180 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)181 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)182 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFrom"}:183 tmpcontentruncontent := NewEG_ContentRunContent()184 tmprunlevelelts := NewEG_RunLevelElts()185 tmprunlevelelts.MoveFrom = NewCT_RunTrackChange()186 if err := d.DecodeElement(tmprunlevelelts.MoveFrom, &el); err != nil {187 return err188 }189 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)190 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)191 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveTo"}:192 tmpcontentruncontent := NewEG_ContentRunContent()193 tmprunlevelelts := NewEG_RunLevelElts()194 tmprunlevelelts.MoveTo = NewCT_RunTrackChange()195 if err := d.DecodeElement(tmprunlevelelts.MoveTo, &el); err != nil {196 return err197 }198 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)199 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)200 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bookmarkStart"}:201 tmpcontentruncontent := NewEG_ContentRunContent()202 tmprunlevelelts := NewEG_RunLevelElts()203 tmprangemarkupelements := NewEG_RangeMarkupElements()204 tmprangemarkupelements.BookmarkStart = NewCT_Bookmark()205 if err := d.DecodeElement(tmprangemarkupelements.BookmarkStart, &el); err != nil {206 return err207 }208 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)209 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)210 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)211 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bookmarkEnd"}:212 tmpcontentruncontent := NewEG_ContentRunContent()213 tmprunlevelelts := NewEG_RunLevelElts()214 tmprangemarkupelements := NewEG_RangeMarkupElements()215 tmprangemarkupelements.BookmarkEnd = NewCT_MarkupRange()216 if err := d.DecodeElement(tmprangemarkupelements.BookmarkEnd, &el); err != nil {217 return err218 }219 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)220 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)221 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)222 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFromRangeStart"}:223 tmpcontentruncontent := NewEG_ContentRunContent()224 tmprunlevelelts := NewEG_RunLevelElts()225 tmprangemarkupelements := NewEG_RangeMarkupElements()226 tmprangemarkupelements.MoveFromRangeStart = NewCT_MoveBookmark()227 if err := d.DecodeElement(tmprangemarkupelements.MoveFromRangeStart, &el); err != nil {228 return err229 }230 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)231 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)232 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)233 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFromRangeEnd"}:234 tmpcontentruncontent := NewEG_ContentRunContent()235 tmprunlevelelts := NewEG_RunLevelElts()236 tmprangemarkupelements := NewEG_RangeMarkupElements()237 tmprangemarkupelements.MoveFromRangeEnd = NewCT_MarkupRange()238 if err := d.DecodeElement(tmprangemarkupelements.MoveFromRangeEnd, &el); err != nil {239 return err240 }241 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)242 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)243 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)244 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveToRangeStart"}:245 tmpcontentruncontent := NewEG_ContentRunContent()246 tmprunlevelelts := NewEG_RunLevelElts()247 tmprangemarkupelements := NewEG_RangeMarkupElements()248 tmprangemarkupelements.MoveToRangeStart = NewCT_MoveBookmark()249 if err := d.DecodeElement(tmprangemarkupelements.MoveToRangeStart, &el); err != nil {250 return err251 }252 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)253 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)254 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)255 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveToRangeEnd"}:256 tmpcontentruncontent := NewEG_ContentRunContent()257 tmprunlevelelts := NewEG_RunLevelElts()258 tmprangemarkupelements := NewEG_RangeMarkupElements()259 tmprangemarkupelements.MoveToRangeEnd = NewCT_MarkupRange()260 if err := d.DecodeElement(tmprangemarkupelements.MoveToRangeEnd, &el); err != nil {261 return err262 }263 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)264 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)265 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)266 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentRangeStart"}:267 tmpcontentruncontent := NewEG_ContentRunContent()268 tmprunlevelelts := NewEG_RunLevelElts()269 tmprangemarkupelements := NewEG_RangeMarkupElements()270 tmprangemarkupelements.CommentRangeStart = NewCT_MarkupRange()271 if err := d.DecodeElement(tmprangemarkupelements.CommentRangeStart, &el); err != nil {272 return err273 }274 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)275 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)276 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)277 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentRangeEnd"}:278 tmpcontentruncontent := NewEG_ContentRunContent()279 tmprunlevelelts := NewEG_RunLevelElts()280 tmprangemarkupelements := NewEG_RangeMarkupElements()281 tmprangemarkupelements.CommentRangeEnd = NewCT_MarkupRange()282 if err := d.DecodeElement(tmprangemarkupelements.CommentRangeEnd, &el); err != nil {283 return err284 }285 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)286 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)287 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)288 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlInsRangeStart"}:289 tmpcontentruncontent := NewEG_ContentRunContent()290 tmprunlevelelts := NewEG_RunLevelElts()291 tmprangemarkupelements := NewEG_RangeMarkupElements()292 tmprangemarkupelements.CustomXmlInsRangeStart = NewCT_TrackChange()293 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlInsRangeStart, &el); err != nil {294 return err295 }296 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)297 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)298 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)299 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlInsRangeEnd"}:300 tmpcontentruncontent := NewEG_ContentRunContent()301 tmprunlevelelts := NewEG_RunLevelElts()302 tmprangemarkupelements := NewEG_RangeMarkupElements()303 tmprangemarkupelements.CustomXmlInsRangeEnd = NewCT_Markup()304 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlInsRangeEnd, &el); err != nil {305 return err306 }307 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)308 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)309 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)310 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlDelRangeStart"}:311 tmpcontentruncontent := NewEG_ContentRunContent()312 tmprunlevelelts := NewEG_RunLevelElts()313 tmprangemarkupelements := NewEG_RangeMarkupElements()314 tmprangemarkupelements.CustomXmlDelRangeStart = NewCT_TrackChange()315 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlDelRangeStart, &el); err != nil {316 return err317 }318 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)319 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)320 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)321 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlDelRangeEnd"}:322 tmpcontentruncontent := NewEG_ContentRunContent()323 tmprunlevelelts := NewEG_RunLevelElts()324 tmprangemarkupelements := NewEG_RangeMarkupElements()325 tmprangemarkupelements.CustomXmlDelRangeEnd = NewCT_Markup()326 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlDelRangeEnd, &el); err != nil {327 return err328 }329 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)330 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)331 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)332 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveFromRangeStart"}:333 tmpcontentruncontent := NewEG_ContentRunContent()334 tmprunlevelelts := NewEG_RunLevelElts()335 tmprangemarkupelements := NewEG_RangeMarkupElements()336 tmprangemarkupelements.CustomXmlMoveFromRangeStart = NewCT_TrackChange()337 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveFromRangeStart, &el); err != nil {338 return err339 }340 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)341 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)342 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)343 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveFromRangeEnd"}:344 tmpcontentruncontent := NewEG_ContentRunContent()345 tmprunlevelelts := NewEG_RunLevelElts()346 tmprangemarkupelements := NewEG_RangeMarkupElements()347 tmprangemarkupelements.CustomXmlMoveFromRangeEnd = NewCT_Markup()348 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveFromRangeEnd, &el); err != nil {349 return err350 }351 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)352 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)353 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)354 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveToRangeStart"}:355 tmpcontentruncontent := NewEG_ContentRunContent()356 tmprunlevelelts := NewEG_RunLevelElts()357 tmprangemarkupelements := NewEG_RangeMarkupElements()358 tmprangemarkupelements.CustomXmlMoveToRangeStart = NewCT_TrackChange()359 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveToRangeStart, &el); err != nil {360 return err361 }362 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)363 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)364 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)365 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveToRangeEnd"}:366 tmpcontentruncontent := NewEG_ContentRunContent()367 tmprunlevelelts := NewEG_RunLevelElts()368 tmprangemarkupelements := NewEG_RangeMarkupElements()369 tmprangemarkupelements.CustomXmlMoveToRangeEnd = NewCT_Markup()370 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveToRangeEnd, &el); err != nil {371 return err372 }373 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)374 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)375 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)376 case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/math", Local: "oMathPara"}:377 tmpcontentruncontent := NewEG_ContentRunContent()378 tmprunlevelelts := NewEG_RunLevelElts()379 tmpmathcontent := NewEG_MathContent()380 tmpmathcontent.OMathPara = math.NewOMathPara()381 if err := d.DecodeElement(tmpmathcontent.OMathPara, &el); err != nil {382 return err383 }384 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)385 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)386 tmprunlevelelts.EG_MathContent = append(tmprunlevelelts.EG_MathContent, tmpmathcontent)387 case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/math", Local: "oMath"}:388 tmpcontentruncontent := NewEG_ContentRunContent()389 tmprunlevelelts := NewEG_RunLevelElts()390 tmpmathcontent := NewEG_MathContent()391 tmpmathcontent.OMath = math.NewOMath()392 if err := d.DecodeElement(tmpmathcontent.OMath, &el); err != nil {393 return err394 }395 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)396 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)397 tmprunlevelelts.EG_MathContent = append(tmprunlevelelts.EG_MathContent, tmpmathcontent)398 default:399 gooxml.Log("skipping unsupported element on CT_BdoContentRun %v", el.Name)400 if err := d.Skip(); err != nil {401 return err402 }403 }404 case xml.EndElement:405 break lCT_BdoContentRun406 case xml.CharData:407 }408 }409 return nil410}411// Validate validates the CT_BdoContentRun and its children412func (m *CT_BdoContentRun) Validate() error {413 return m.ValidateWithPath("CT_BdoContentRun")414}415// ValidateWithPath validates the CT_BdoContentRun and its children, prefixing error messages with path416func (m *CT_BdoContentRun) ValidateWithPath(path string) error {417 if err := m.ValAttr.ValidateWithPath(path + "/ValAttr"); err != nil {418 return err419 }420 for i, v := range m.FldSimple {421 if err := v.ValidateWithPath(fmt.Sprintf("%s/FldSimple[%d]", path, i)); err != nil {422 return err423 }424 }425 if m.Hyperlink != nil {426 if err := m.Hyperlink.ValidateWithPath(path + "/Hyperlink"); err != nil {427 return err428 }429 }430 if m.SubDoc != nil {431 if err := m.SubDoc.ValidateWithPath(path + "/SubDoc"); err != nil {432 return err433 }434 }435 for i, v := range m.EG_ContentRunContent {436 if err := v.ValidateWithPath(fmt.Sprintf("%s/EG_ContentRunContent[%d]", path, i)); err != nil {437 return err438 }439 }440 return nil441}...

Full Screen

Full Screen

CT_SdtContentRun.go

Source:CT_SdtContentRun.go Github

copy

Full Screen

...12 "fmt"13 "baliance.com/gooxml"14 "baliance.com/gooxml/schema/soo/ofc/math"15)16type CT_SdtContentRun struct {17 // Simple Field18 FldSimple []*CT_SimpleField19 // Hyperlink20 Hyperlink *CT_Hyperlink21 // Anchor for Subdocument Location22 SubDoc *CT_Rel23 EG_ContentRunContent []*EG_ContentRunContent24}25func NewCT_SdtContentRun() *CT_SdtContentRun {26 ret := &CT_SdtContentRun{}27 return ret28}29func (m *CT_SdtContentRun) MarshalXML(e *xml.Encoder, start xml.StartElement) error {30 e.EncodeToken(start)31 if m.FldSimple != nil {32 sefldSimple := xml.StartElement{Name: xml.Name{Local: "w:fldSimple"}}33 for _, c := range m.FldSimple {34 e.EncodeElement(c, sefldSimple)35 }36 }37 if m.Hyperlink != nil {38 sehyperlink := xml.StartElement{Name: xml.Name{Local: "w:hyperlink"}}39 e.EncodeElement(m.Hyperlink, sehyperlink)40 }41 if m.SubDoc != nil {42 sesubDoc := xml.StartElement{Name: xml.Name{Local: "w:subDoc"}}43 e.EncodeElement(m.SubDoc, sesubDoc)44 }45 if m.EG_ContentRunContent != nil {46 for _, c := range m.EG_ContentRunContent {47 c.MarshalXML(e, xml.StartElement{})48 }49 }50 e.EncodeToken(xml.EndElement{Name: start.Name})51 return nil52}53func (m *CT_SdtContentRun) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {54 // initialize to default55lCT_SdtContentRun:56 for {57 tok, err := d.Token()58 if err != nil {59 return err60 }61 switch el := tok.(type) {62 case xml.StartElement:63 switch el.Name {64 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "fldSimple"}:65 tmp := NewCT_SimpleField()66 if err := d.DecodeElement(tmp, &el); err != nil {67 return err68 }69 m.FldSimple = append(m.FldSimple, tmp)70 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "hyperlink"}:71 m.Hyperlink = NewCT_Hyperlink()72 if err := d.DecodeElement(m.Hyperlink, &el); err != nil {73 return err74 }75 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "subDoc"}:76 m.SubDoc = NewCT_Rel()77 if err := d.DecodeElement(m.SubDoc, &el); err != nil {78 return err79 }80 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXml"}:81 tmpcontentruncontent := NewEG_ContentRunContent()82 tmpcontentruncontent.CustomXml = NewCT_CustomXmlRun()83 if err := d.DecodeElement(tmpcontentruncontent.CustomXml, &el); err != nil {84 return err85 }86 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)87 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "smartTag"}:88 tmpcontentruncontent := NewEG_ContentRunContent()89 tmpcontentruncontent.SmartTag = NewCT_SmartTagRun()90 if err := d.DecodeElement(tmpcontentruncontent.SmartTag, &el); err != nil {91 return err92 }93 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)94 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "sdt"}:95 tmpcontentruncontent := NewEG_ContentRunContent()96 tmpcontentruncontent.Sdt = NewCT_SdtRun()97 if err := d.DecodeElement(tmpcontentruncontent.Sdt, &el); err != nil {98 return err99 }100 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)101 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dir"}:102 tmpcontentruncontent := NewEG_ContentRunContent()103 tmpcontentruncontent.Dir = NewCT_DirContentRun()104 if err := d.DecodeElement(tmpcontentruncontent.Dir, &el); err != nil {105 return err106 }107 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)108 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bdo"}:109 tmpcontentruncontent := NewEG_ContentRunContent()110 tmpcontentruncontent.Bdo = NewCT_BdoContentRun()111 if err := d.DecodeElement(tmpcontentruncontent.Bdo, &el); err != nil {112 return err113 }114 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)115 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "r"}:116 tmpcontentruncontent := NewEG_ContentRunContent()117 tmpcontentruncontent.R = NewCT_R()118 if err := d.DecodeElement(tmpcontentruncontent.R, &el); err != nil {119 return err120 }121 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)122 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "proofErr"}:123 tmpcontentruncontent := NewEG_ContentRunContent()124 tmprunlevelelts := NewEG_RunLevelElts()125 tmprunlevelelts.ProofErr = NewCT_ProofErr()126 if err := d.DecodeElement(tmprunlevelelts.ProofErr, &el); err != nil {127 return err128 }129 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)130 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)131 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "permStart"}:132 tmpcontentruncontent := NewEG_ContentRunContent()133 tmprunlevelelts := NewEG_RunLevelElts()134 tmprunlevelelts.PermStart = NewCT_PermStart()135 if err := d.DecodeElement(tmprunlevelelts.PermStart, &el); err != nil {136 return err137 }138 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)139 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)140 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "permEnd"}:141 tmpcontentruncontent := NewEG_ContentRunContent()142 tmprunlevelelts := NewEG_RunLevelElts()143 tmprunlevelelts.PermEnd = NewCT_Perm()144 if err := d.DecodeElement(tmprunlevelelts.PermEnd, &el); err != nil {145 return err146 }147 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)148 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)149 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "ins"}:150 tmpcontentruncontent := NewEG_ContentRunContent()151 tmprunlevelelts := NewEG_RunLevelElts()152 tmprunlevelelts.Ins = NewCT_RunTrackChange()153 if err := d.DecodeElement(tmprunlevelelts.Ins, &el); err != nil {154 return err155 }156 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)157 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)158 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "del"}:159 tmpcontentruncontent := NewEG_ContentRunContent()160 tmprunlevelelts := NewEG_RunLevelElts()161 tmprunlevelelts.Del = NewCT_RunTrackChange()162 if err := d.DecodeElement(tmprunlevelelts.Del, &el); err != nil {163 return err164 }165 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)166 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)167 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFrom"}:168 tmpcontentruncontent := NewEG_ContentRunContent()169 tmprunlevelelts := NewEG_RunLevelElts()170 tmprunlevelelts.MoveFrom = NewCT_RunTrackChange()171 if err := d.DecodeElement(tmprunlevelelts.MoveFrom, &el); err != nil {172 return err173 }174 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)175 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)176 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveTo"}:177 tmpcontentruncontent := NewEG_ContentRunContent()178 tmprunlevelelts := NewEG_RunLevelElts()179 tmprunlevelelts.MoveTo = NewCT_RunTrackChange()180 if err := d.DecodeElement(tmprunlevelelts.MoveTo, &el); err != nil {181 return err182 }183 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)184 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)185 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bookmarkStart"}:186 tmpcontentruncontent := NewEG_ContentRunContent()187 tmprunlevelelts := NewEG_RunLevelElts()188 tmprangemarkupelements := NewEG_RangeMarkupElements()189 tmprangemarkupelements.BookmarkStart = NewCT_Bookmark()190 if err := d.DecodeElement(tmprangemarkupelements.BookmarkStart, &el); err != nil {191 return err192 }193 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)194 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)195 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)196 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bookmarkEnd"}:197 tmpcontentruncontent := NewEG_ContentRunContent()198 tmprunlevelelts := NewEG_RunLevelElts()199 tmprangemarkupelements := NewEG_RangeMarkupElements()200 tmprangemarkupelements.BookmarkEnd = NewCT_MarkupRange()201 if err := d.DecodeElement(tmprangemarkupelements.BookmarkEnd, &el); err != nil {202 return err203 }204 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)205 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)206 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)207 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFromRangeStart"}:208 tmpcontentruncontent := NewEG_ContentRunContent()209 tmprunlevelelts := NewEG_RunLevelElts()210 tmprangemarkupelements := NewEG_RangeMarkupElements()211 tmprangemarkupelements.MoveFromRangeStart = NewCT_MoveBookmark()212 if err := d.DecodeElement(tmprangemarkupelements.MoveFromRangeStart, &el); err != nil {213 return err214 }215 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)216 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)217 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)218 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFromRangeEnd"}:219 tmpcontentruncontent := NewEG_ContentRunContent()220 tmprunlevelelts := NewEG_RunLevelElts()221 tmprangemarkupelements := NewEG_RangeMarkupElements()222 tmprangemarkupelements.MoveFromRangeEnd = NewCT_MarkupRange()223 if err := d.DecodeElement(tmprangemarkupelements.MoveFromRangeEnd, &el); err != nil {224 return err225 }226 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)227 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)228 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)229 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveToRangeStart"}:230 tmpcontentruncontent := NewEG_ContentRunContent()231 tmprunlevelelts := NewEG_RunLevelElts()232 tmprangemarkupelements := NewEG_RangeMarkupElements()233 tmprangemarkupelements.MoveToRangeStart = NewCT_MoveBookmark()234 if err := d.DecodeElement(tmprangemarkupelements.MoveToRangeStart, &el); err != nil {235 return err236 }237 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)238 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)239 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)240 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveToRangeEnd"}:241 tmpcontentruncontent := NewEG_ContentRunContent()242 tmprunlevelelts := NewEG_RunLevelElts()243 tmprangemarkupelements := NewEG_RangeMarkupElements()244 tmprangemarkupelements.MoveToRangeEnd = NewCT_MarkupRange()245 if err := d.DecodeElement(tmprangemarkupelements.MoveToRangeEnd, &el); err != nil {246 return err247 }248 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)249 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)250 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)251 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentRangeStart"}:252 tmpcontentruncontent := NewEG_ContentRunContent()253 tmprunlevelelts := NewEG_RunLevelElts()254 tmprangemarkupelements := NewEG_RangeMarkupElements()255 tmprangemarkupelements.CommentRangeStart = NewCT_MarkupRange()256 if err := d.DecodeElement(tmprangemarkupelements.CommentRangeStart, &el); err != nil {257 return err258 }259 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)260 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)261 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)262 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentRangeEnd"}:263 tmpcontentruncontent := NewEG_ContentRunContent()264 tmprunlevelelts := NewEG_RunLevelElts()265 tmprangemarkupelements := NewEG_RangeMarkupElements()266 tmprangemarkupelements.CommentRangeEnd = NewCT_MarkupRange()267 if err := d.DecodeElement(tmprangemarkupelements.CommentRangeEnd, &el); err != nil {268 return err269 }270 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)271 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)272 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)273 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlInsRangeStart"}:274 tmpcontentruncontent := NewEG_ContentRunContent()275 tmprunlevelelts := NewEG_RunLevelElts()276 tmprangemarkupelements := NewEG_RangeMarkupElements()277 tmprangemarkupelements.CustomXmlInsRangeStart = NewCT_TrackChange()278 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlInsRangeStart, &el); err != nil {279 return err280 }281 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)282 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)283 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)284 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlInsRangeEnd"}:285 tmpcontentruncontent := NewEG_ContentRunContent()286 tmprunlevelelts := NewEG_RunLevelElts()287 tmprangemarkupelements := NewEG_RangeMarkupElements()288 tmprangemarkupelements.CustomXmlInsRangeEnd = NewCT_Markup()289 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlInsRangeEnd, &el); err != nil {290 return err291 }292 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)293 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)294 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)295 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlDelRangeStart"}:296 tmpcontentruncontent := NewEG_ContentRunContent()297 tmprunlevelelts := NewEG_RunLevelElts()298 tmprangemarkupelements := NewEG_RangeMarkupElements()299 tmprangemarkupelements.CustomXmlDelRangeStart = NewCT_TrackChange()300 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlDelRangeStart, &el); err != nil {301 return err302 }303 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)304 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)305 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)306 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlDelRangeEnd"}:307 tmpcontentruncontent := NewEG_ContentRunContent()308 tmprunlevelelts := NewEG_RunLevelElts()309 tmprangemarkupelements := NewEG_RangeMarkupElements()310 tmprangemarkupelements.CustomXmlDelRangeEnd = NewCT_Markup()311 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlDelRangeEnd, &el); err != nil {312 return err313 }314 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)315 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)316 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)317 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveFromRangeStart"}:318 tmpcontentruncontent := NewEG_ContentRunContent()319 tmprunlevelelts := NewEG_RunLevelElts()320 tmprangemarkupelements := NewEG_RangeMarkupElements()321 tmprangemarkupelements.CustomXmlMoveFromRangeStart = NewCT_TrackChange()322 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveFromRangeStart, &el); err != nil {323 return err324 }325 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)326 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)327 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)328 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveFromRangeEnd"}:329 tmpcontentruncontent := NewEG_ContentRunContent()330 tmprunlevelelts := NewEG_RunLevelElts()331 tmprangemarkupelements := NewEG_RangeMarkupElements()332 tmprangemarkupelements.CustomXmlMoveFromRangeEnd = NewCT_Markup()333 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveFromRangeEnd, &el); err != nil {334 return err335 }336 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)337 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)338 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)339 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveToRangeStart"}:340 tmpcontentruncontent := NewEG_ContentRunContent()341 tmprunlevelelts := NewEG_RunLevelElts()342 tmprangemarkupelements := NewEG_RangeMarkupElements()343 tmprangemarkupelements.CustomXmlMoveToRangeStart = NewCT_TrackChange()344 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveToRangeStart, &el); err != nil {345 return err346 }347 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)348 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)349 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)350 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveToRangeEnd"}:351 tmpcontentruncontent := NewEG_ContentRunContent()352 tmprunlevelelts := NewEG_RunLevelElts()353 tmprangemarkupelements := NewEG_RangeMarkupElements()354 tmprangemarkupelements.CustomXmlMoveToRangeEnd = NewCT_Markup()355 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveToRangeEnd, &el); err != nil {356 return err357 }358 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)359 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)360 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)361 case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/math", Local: "oMathPara"}:362 tmpcontentruncontent := NewEG_ContentRunContent()363 tmprunlevelelts := NewEG_RunLevelElts()364 tmpmathcontent := NewEG_MathContent()365 tmpmathcontent.OMathPara = math.NewOMathPara()366 if err := d.DecodeElement(tmpmathcontent.OMathPara, &el); err != nil {367 return err368 }369 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)370 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)371 tmprunlevelelts.EG_MathContent = append(tmprunlevelelts.EG_MathContent, tmpmathcontent)372 case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/math", Local: "oMath"}:373 tmpcontentruncontent := NewEG_ContentRunContent()374 tmprunlevelelts := NewEG_RunLevelElts()375 tmpmathcontent := NewEG_MathContent()376 tmpmathcontent.OMath = math.NewOMath()377 if err := d.DecodeElement(tmpmathcontent.OMath, &el); err != nil {378 return err379 }380 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)381 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)382 tmprunlevelelts.EG_MathContent = append(tmprunlevelelts.EG_MathContent, tmpmathcontent)383 default:384 gooxml.Log("skipping unsupported element on CT_SdtContentRun %v", el.Name)385 if err := d.Skip(); err != nil {386 return err387 }388 }389 case xml.EndElement:390 break lCT_SdtContentRun391 case xml.CharData:392 }393 }394 return nil395}396// Validate validates the CT_SdtContentRun and its children397func (m *CT_SdtContentRun) Validate() error {398 return m.ValidateWithPath("CT_SdtContentRun")399}400// ValidateWithPath validates the CT_SdtContentRun and its children, prefixing error messages with path401func (m *CT_SdtContentRun) ValidateWithPath(path string) error {402 for i, v := range m.FldSimple {403 if err := v.ValidateWithPath(fmt.Sprintf("%s/FldSimple[%d]", path, i)); err != nil {404 return err405 }406 }407 if m.Hyperlink != nil {408 if err := m.Hyperlink.ValidateWithPath(path + "/Hyperlink"); err != nil {409 return err410 }411 }412 if m.SubDoc != nil {413 if err := m.SubDoc.ValidateWithPath(path + "/SubDoc"); err != nil {414 return err415 }416 }417 for i, v := range m.EG_ContentRunContent {418 if err := v.ValidateWithPath(fmt.Sprintf("%s/EG_ContentRunContent[%d]", path, i)); err != nil {419 return err420 }421 }422 return nil423}...

Full Screen

Full Screen

CT_R.go

Source:CT_R.go Github

copy

Full Screen

...12 "fmt"13 "baliance.com/gooxml"14)15type CT_R struct {16 // Revision Identifier for Run Properties17 RsidRPrAttr *string18 // Revision Identifier for Run Deletion19 RsidDelAttr *string20 // Revision Identifier for Run21 RsidRAttr *string22 // Run Properties23 RPr *CT_RPr24 EG_RunInnerContent []*EG_RunInnerContent25 Extra []gooxml.Any26}27func NewCT_R() *CT_R {28 ret := &CT_R{}29 return ret30}31func (m *CT_R) MarshalXML(e *xml.Encoder, start xml.StartElement) error {32 if m.RsidRPrAttr != nil {33 start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "w:rsidRPr"},34 Value: fmt.Sprintf("%v", *m.RsidRPrAttr)})35 }36 if m.RsidDelAttr != nil {37 start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "w:rsidDel"},38 Value: fmt.Sprintf("%v", *m.RsidDelAttr)})39 }40 if m.RsidRAttr != nil {41 start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "w:rsidR"},42 Value: fmt.Sprintf("%v", *m.RsidRAttr)})43 }44 e.EncodeToken(start)45 if m.RPr != nil {46 serPr := xml.StartElement{Name: xml.Name{Local: "w:rPr"}}47 e.EncodeElement(m.RPr, serPr)48 }49 if m.EG_RunInnerContent != nil {50 for _, c := range m.EG_RunInnerContent {51 c.MarshalXML(e, xml.StartElement{})52 }53 }54 for _, any := range m.Extra {55 if err := any.MarshalXML(e, xml.StartElement{}); err != nil {56 return err57 }58 }59 e.EncodeToken(xml.EndElement{Name: start.Name})60 return nil61}62func (m *CT_R) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {63 // initialize to default64 for _, attr := range start.Attr {65 if attr.Name.Local == "rsidRPr" {66 parsed, err := attr.Value, error(nil)67 if err != nil {68 return err69 }70 m.RsidRPrAttr = &parsed71 continue72 }73 if attr.Name.Local == "rsidDel" {74 parsed, err := attr.Value, error(nil)75 if err != nil {76 return err77 }78 m.RsidDelAttr = &parsed79 continue80 }81 if attr.Name.Local == "rsidR" {82 parsed, err := attr.Value, error(nil)83 if err != nil {84 return err85 }86 m.RsidRAttr = &parsed87 continue88 }89 }90lCT_R:91 for {92 tok, err := d.Token()93 if err != nil {94 return err95 }96 switch el := tok.(type) {97 case xml.StartElement:98 switch el.Name {99 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "rPr"}:100 m.RPr = NewCT_RPr()101 if err := d.DecodeElement(m.RPr, &el); err != nil {102 return err103 }104 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "br"}:105 tmpruninnercontent := NewEG_RunInnerContent()106 tmpruninnercontent.Br = NewCT_Br()107 if err := d.DecodeElement(tmpruninnercontent.Br, &el); err != nil {108 return err109 }110 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)111 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "t"}:112 tmpruninnercontent := NewEG_RunInnerContent()113 tmpruninnercontent.T = NewCT_Text()114 if err := d.DecodeElement(tmpruninnercontent.T, &el); err != nil {115 return err116 }117 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)118 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "contentPart"}:119 tmpruninnercontent := NewEG_RunInnerContent()120 tmpruninnercontent.ContentPart = NewCT_Rel()121 if err := d.DecodeElement(tmpruninnercontent.ContentPart, &el); err != nil {122 return err123 }124 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)125 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "delText"}:126 tmpruninnercontent := NewEG_RunInnerContent()127 tmpruninnercontent.DelText = NewCT_Text()128 if err := d.DecodeElement(tmpruninnercontent.DelText, &el); err != nil {129 return err130 }131 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)132 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "instrText"}:133 tmpruninnercontent := NewEG_RunInnerContent()134 tmpruninnercontent.InstrText = NewCT_Text()135 if err := d.DecodeElement(tmpruninnercontent.InstrText, &el); err != nil {136 return err137 }138 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)139 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "delInstrText"}:140 tmpruninnercontent := NewEG_RunInnerContent()141 tmpruninnercontent.DelInstrText = NewCT_Text()142 if err := d.DecodeElement(tmpruninnercontent.DelInstrText, &el); err != nil {143 return err144 }145 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)146 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "noBreakHyphen"}:147 tmpruninnercontent := NewEG_RunInnerContent()148 tmpruninnercontent.NoBreakHyphen = NewCT_Empty()149 if err := d.DecodeElement(tmpruninnercontent.NoBreakHyphen, &el); err != nil {150 return err151 }152 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)153 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "softHyphen"}:154 tmpruninnercontent := NewEG_RunInnerContent()155 tmpruninnercontent.SoftHyphen = NewCT_Empty()156 if err := d.DecodeElement(tmpruninnercontent.SoftHyphen, &el); err != nil {157 return err158 }159 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)160 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dayShort"}:161 tmpruninnercontent := NewEG_RunInnerContent()162 tmpruninnercontent.DayShort = NewCT_Empty()163 if err := d.DecodeElement(tmpruninnercontent.DayShort, &el); err != nil {164 return err165 }166 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)167 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "monthShort"}:168 tmpruninnercontent := NewEG_RunInnerContent()169 tmpruninnercontent.MonthShort = NewCT_Empty()170 if err := d.DecodeElement(tmpruninnercontent.MonthShort, &el); err != nil {171 return err172 }173 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)174 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "yearShort"}:175 tmpruninnercontent := NewEG_RunInnerContent()176 tmpruninnercontent.YearShort = NewCT_Empty()177 if err := d.DecodeElement(tmpruninnercontent.YearShort, &el); err != nil {178 return err179 }180 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)181 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dayLong"}:182 tmpruninnercontent := NewEG_RunInnerContent()183 tmpruninnercontent.DayLong = NewCT_Empty()184 if err := d.DecodeElement(tmpruninnercontent.DayLong, &el); err != nil {185 return err186 }187 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)188 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "monthLong"}:189 tmpruninnercontent := NewEG_RunInnerContent()190 tmpruninnercontent.MonthLong = NewCT_Empty()191 if err := d.DecodeElement(tmpruninnercontent.MonthLong, &el); err != nil {192 return err193 }194 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)195 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "yearLong"}:196 tmpruninnercontent := NewEG_RunInnerContent()197 tmpruninnercontent.YearLong = NewCT_Empty()198 if err := d.DecodeElement(tmpruninnercontent.YearLong, &el); err != nil {199 return err200 }201 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)202 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "annotationRef"}:203 tmpruninnercontent := NewEG_RunInnerContent()204 tmpruninnercontent.AnnotationRef = NewCT_Empty()205 if err := d.DecodeElement(tmpruninnercontent.AnnotationRef, &el); err != nil {206 return err207 }208 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)209 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "footnoteRef"}:210 tmpruninnercontent := NewEG_RunInnerContent()211 tmpruninnercontent.FootnoteRef = NewCT_Empty()212 if err := d.DecodeElement(tmpruninnercontent.FootnoteRef, &el); err != nil {213 return err214 }215 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)216 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "endnoteRef"}:217 tmpruninnercontent := NewEG_RunInnerContent()218 tmpruninnercontent.EndnoteRef = NewCT_Empty()219 if err := d.DecodeElement(tmpruninnercontent.EndnoteRef, &el); err != nil {220 return err221 }222 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)223 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "separator"}:224 tmpruninnercontent := NewEG_RunInnerContent()225 tmpruninnercontent.Separator = NewCT_Empty()226 if err := d.DecodeElement(tmpruninnercontent.Separator, &el); err != nil {227 return err228 }229 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)230 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "continuationSeparator"}:231 tmpruninnercontent := NewEG_RunInnerContent()232 tmpruninnercontent.ContinuationSeparator = NewCT_Empty()233 if err := d.DecodeElement(tmpruninnercontent.ContinuationSeparator, &el); err != nil {234 return err235 }236 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)237 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "sym"}:238 tmpruninnercontent := NewEG_RunInnerContent()239 tmpruninnercontent.Sym = NewCT_Sym()240 if err := d.DecodeElement(tmpruninnercontent.Sym, &el); err != nil {241 return err242 }243 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)244 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "pgNum"}:245 tmpruninnercontent := NewEG_RunInnerContent()246 tmpruninnercontent.PgNum = NewCT_Empty()247 if err := d.DecodeElement(tmpruninnercontent.PgNum, &el); err != nil {248 return err249 }250 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)251 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "cr"}:252 tmpruninnercontent := NewEG_RunInnerContent()253 tmpruninnercontent.Cr = NewCT_Empty()254 if err := d.DecodeElement(tmpruninnercontent.Cr, &el); err != nil {255 return err256 }257 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)258 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "tab"}:259 tmpruninnercontent := NewEG_RunInnerContent()260 tmpruninnercontent.Tab = NewCT_Empty()261 if err := d.DecodeElement(tmpruninnercontent.Tab, &el); err != nil {262 return err263 }264 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)265 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "object"}:266 tmpruninnercontent := NewEG_RunInnerContent()267 tmpruninnercontent.Object = NewCT_Object()268 if err := d.DecodeElement(tmpruninnercontent.Object, &el); err != nil {269 return err270 }271 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)272 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "pict"}:273 tmpruninnercontent := NewEG_RunInnerContent()274 tmpruninnercontent.Pict = NewCT_Picture()275 if err := d.DecodeElement(tmpruninnercontent.Pict, &el); err != nil {276 return err277 }278 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)279 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "fldChar"}:280 tmpruninnercontent := NewEG_RunInnerContent()281 tmpruninnercontent.FldChar = NewCT_FldChar()282 if err := d.DecodeElement(tmpruninnercontent.FldChar, &el); err != nil {283 return err284 }285 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)286 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "ruby"}:287 tmpruninnercontent := NewEG_RunInnerContent()288 tmpruninnercontent.Ruby = NewCT_Ruby()289 if err := d.DecodeElement(tmpruninnercontent.Ruby, &el); err != nil {290 return err291 }292 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)293 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "footnoteReference"}:294 tmpruninnercontent := NewEG_RunInnerContent()295 tmpruninnercontent.FootnoteReference = NewCT_FtnEdnRef()296 if err := d.DecodeElement(tmpruninnercontent.FootnoteReference, &el); err != nil {297 return err298 }299 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)300 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "endnoteReference"}:301 tmpruninnercontent := NewEG_RunInnerContent()302 tmpruninnercontent.EndnoteReference = NewCT_FtnEdnRef()303 if err := d.DecodeElement(tmpruninnercontent.EndnoteReference, &el); err != nil {304 return err305 }306 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)307 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentReference"}:308 tmpruninnercontent := NewEG_RunInnerContent()309 tmpruninnercontent.CommentReference = NewCT_Markup()310 if err := d.DecodeElement(tmpruninnercontent.CommentReference, &el); err != nil {311 return err312 }313 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)314 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "drawing"}:315 tmpruninnercontent := NewEG_RunInnerContent()316 tmpruninnercontent.Drawing = NewCT_Drawing()317 if err := d.DecodeElement(tmpruninnercontent.Drawing, &el); err != nil {318 return err319 }320 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)321 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "ptab"}:322 tmpruninnercontent := NewEG_RunInnerContent()323 tmpruninnercontent.Ptab = NewCT_PTab()324 if err := d.DecodeElement(tmpruninnercontent.Ptab, &el); err != nil {325 return err326 }327 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)328 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "lastRenderedPageBreak"}:329 tmpruninnercontent := NewEG_RunInnerContent()330 tmpruninnercontent.LastRenderedPageBreak = NewCT_Empty()331 if err := d.DecodeElement(tmpruninnercontent.LastRenderedPageBreak, &el); err != nil {332 return err333 }334 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)335 default:336 any := &gooxml.XSDAny{}337 if err := d.DecodeElement(any, &el); err != nil {338 return err339 }340 m.Extra = append(m.Extra, any)341 }342 case xml.EndElement:343 break lCT_R344 case xml.CharData:345 }346 }347 return nil348}349// Validate validates the CT_R and its children350func (m *CT_R) Validate() error {351 return m.ValidateWithPath("CT_R")352}353// ValidateWithPath validates the CT_R and its children, prefixing error messages with path354func (m *CT_R) ValidateWithPath(path string) error {355 if m.RPr != nil {356 if err := m.RPr.ValidateWithPath(path + "/RPr"); err != nil {357 return err358 }359 }360 for i, v := range m.EG_RunInnerContent {361 if err := v.ValidateWithPath(fmt.Sprintf("%s/EG_RunInnerContent[%d]", path, i)); err != nil {362 return err363 }364 }365 return nil366}...

Full Screen

Full Screen

strategy_cover_test.go

Source:strategy_cover_test.go Github

copy

Full Screen

...8 "reflect"9 "sort"10 "testing"11)12func TestCoverStrategyTestsToRun(t *testing.T) {13 var (14 gomod = []byte(`module cover-strategy-test-run15 go 1.1316 `)17 mainFile = []byte(`package main18 import (19 "fmt"20 "cover-strategy-test-run/pkga"21 )22 var a, b int = 10, 2023 func main() {24 fmt.Printf("%+v\n", add(a, b))25 }26 func sub(a, b int) int {27 return pkga.Sub(a, b)28 }29 `)30 fileA = []byte(`package main31 func add(a, b int) int {32 return a + b33 }34 func mul(a, b int) int {35 return a * b36 }37 `)38 mainTestFile = []byte(`package main39 import (40 "testing"41 )42 func TestAdd(t *testing.T) {43 if add(3, 4) != 7 {44 t.Error("add unexpected result")45 }46 }47 func TestMul(t *testing.T) {48 if mul(10, 5) != 50 {49 t.Error("mul unexpected result")50 }51 }52 `)53 pkgAFileA = []byte(`package pkga54 func Div(a, b int) int {55 return a / b56 }57 func Sub(a, b int) int {58 return a - b59 }60 `)61 pkgATestFile = []byte(`package pkga62 import (63 "testing"64 )65 func TestDiv(t *testing.T) {66 if Div(3, 2) != 1 {67 t.Error("Div unexpected result")68 }69 }70 func TestSub(t *testing.T) {71 if Sub(10, 5) != 5 {72 t.Error("Sub unexpected result")73 }74 }`)75 fileAAddDouble = []byte(`package main76 func add(a, b int) int {77 return a + b78 }79 func mul(a, b int) int {80 return a * b81 }82 func double(a int) int {83 return 2 * a84 }85 `)86 mainTestFileAddDouble = []byte(`package main87 import (88 "testing"89 )90 func TestAdd(t *testing.T) {91 if add(3, 4) != 7 {92 t.Error("add unexpected result")93 }94 }95 func TestMul(t *testing.T) {96 if mul(10, 5) != 50 {97 t.Error("mul unexpected result")98 }99 }100 func TestDouble(t *testing.T) {101 if double(1) != 2 {102 t.Error("double unexpected result")103 }104 }105 `)106 fileAChangeMul = []byte(`package main107 func add(a, b int) int {108 return a + b109 }110 func mul(a, b int) int {111 return a * b * 1112 }113 func double(a int) int {114 return 2 * a115 }116 `)117 pkgAfileAChangeSub = []byte(`package pkga118 func Div(a, b int) int {119 return a / b120 }121 func Sub(a, b int) int {122 return a - b + 0123 }`)124 pkgATestFileUpdate = []byte(`package pkga125 import (126 "testing"127 )128 func TestDiv(t *testing.T) {129 if Div(6, 2) != 3 {130 t.Error("Div unexpected result")131 }132 }133 func TestSub(t *testing.T) {134 if Sub(10, 5) != 5 {135 t.Error("Sub unexpected result")136 }137 }`)138 testAddProf = []byte(`mode: set139cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 0140cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 0141cover-strategy-test-run/file_a.go:3.26,5.4 1 1142cover-strategy-test-run/file_a.go:7.26,9.4 1 0143cover-strategy-test-run/file_a.go:11.26,13.4 1 0144cover-strategy-test-run/main.go:10.15,12.4 1 0145cover-strategy-test-run/main.go:14.26,16.4 1 0146`)147 testDivProf = []byte(`mode: set148cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 1149cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 0150cover-strategy-test-run/file_a.go:3.26,5.4 1 0151cover-strategy-test-run/file_a.go:7.26,9.4 1 0152cover-strategy-test-run/file_a.go:11.26,13.4 1 0153cover-strategy-test-run/main.go:10.15,12.4 1 0154cover-strategy-test-run/main.go:14.26,16.4 1 0155`)156 testDoubleProf = []byte(`mode: set157cover-strategy-test-run/file_a.go:3.26,5.4 1 0158cover-strategy-test-run/file_a.go:7.26,9.4 1 0159cover-strategy-test-run/file_a.go:11.26,13.4 1 1160cover-strategy-test-run/main.go:10.15,12.4 1 0161cover-strategy-test-run/main.go:14.26,16.4 1 0162cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 0163cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 0164`)165 testMulProf = []byte(`mode: set166cover-strategy-test-run/main.go:10.15,12.4 1 0167cover-strategy-test-run/main.go:14.26,16.4 1 0168cover-strategy-test-run/file_a.go:3.26,5.4 1 0169cover-strategy-test-run/file_a.go:7.26,9.4 1 1170cover-strategy-test-run/file_a.go:11.26,13.4 1 0171cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 0172cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 0173`)174 testSubProf = []byte(`mode: set175cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 0176cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 1177cover-strategy-test-run/file_a.go:3.26,5.4 1 0178cover-strategy-test-run/file_a.go:7.26,9.4 1 0179cover-strategy-test-run/file_a.go:11.26,13.4 1 0180cover-strategy-test-run/main.go:10.15,12.4 1 0181cover-strategy-test-run/main.go:14.26,16.4 1 0182`)183 )184 // setup185 testDir := filepath.Join(os.TempDir(), "test_cover_strategy_tests_to_run")186 gitCmdRun := NewGitCmd(testDir)187 pkgAFileAPath := filepath.Join("pkga", "file_a.go")188 pkgATestFileAPath := filepath.Join("pkga", "file_a_test.go")189 files := map[string][]byte{190 "go.mod": gomod,191 "main.go": mainFile, "file_a.go": fileA, "main_test.go": mainTestFile,192 pkgAFileAPath: pkgAFileA, pkgATestFileAPath: pkgATestFile,193 }194 logger := log.New(os.Stdout, "gtr-cover-strategy-test:", log.Ltime)195 setup := func() *CoverStrategy {196 setupTestGitDir(t,197 testDir, files,198 []string{199 "go.mod", "main.go", "main_test.go", "file_a.go",200 pkgAFileAPath, pkgATestFileAPath,201 },202 )203 // TODO test with different configurations204 return NewCoverStrategy(true, testDir, logger)205 }206 // teardown207 defer func() {208 if !t.Failed() {209 // clean tmp dir on test success210 _ = os.RemoveAll(testDir)211 }212 }()213 cases := []struct {214 desc string215 setup, tearDown func() error216 outTests []string217 err error218 }{219 {220 desc: "No changes in files, no cover profiles",221 outTests: []string{"cover-strategy-test-run.TestAdd",222 "cover-strategy-test-run.TestMul",223 "cover-strategy-test-run/pkga.TestDiv",224 "cover-strategy-test-run/pkga.TestSub"},225 },226 {227 desc: "Add func double in file_a.go",228 setup: func() error {229 return ioutil.WriteFile(230 filepath.Join(testDir, "file_a.go"), fileAAddDouble, 0600)231 },232 tearDown: func() error {233 files := [][]byte{234 []byte("cover-strategy-test-run.TestAdd"),235 testAddProf,236 []byte("cover-strategy-test-run.TestMul"),237 testMulProf,238 []byte("cover-strategy-test-run.TestDouble"),239 testDoubleProf,240 []byte("cover-strategy-test-run_pkga.TestSub"),241 testSubProf,242 []byte("cover-strategy-test-run_pkga.TestDiv"),243 testDivProf,244 }245 for i := 0; i < len(files); i += 2 {246 err := ioutil.WriteFile(247 filepath.Join(testDir, ".gtr", string(files[i])),248 files[i+1], 0600)249 if err != nil {250 return err251 }252 }253 return gitCmdRun("commit", "-am", "changes")254 },255 outTests: nil,256 },257 {258 desc: "Add test to Double",259 setup: func() error {260 return ioutil.WriteFile(261 filepath.Join(testDir, "main_test.go"),262 mainTestFileAddDouble, 0600)263 },264 tearDown: func() error {265 return gitCmdRun("commit", "-am", "commit changes") // Test266 },267 outTests: []string{"cover-strategy-test-run.TestDouble"},268 },269 {270 desc: "Update mul func in file_a.go and sub in pkga/file_a.go",271 setup: func() error {272 err := ioutil.WriteFile(273 filepath.Join(testDir, "file_a.go"),274 fileAChangeMul, 0600)275 if err != nil {276 return err277 }278 return ioutil.WriteFile(279 filepath.Join(testDir, pkgAFileAPath),280 pkgAfileAChangeSub, 0600)281 },282 tearDown: func() error {283 return gitCmdRun("commit", "-am", "commit changes")284 },285 outTests: []string{"cover-strategy-test-run.TestMul",286 "cover-strategy-test-run/pkga.TestSub"},287 },288 {289 desc: "Update in pkga",290 setup: func() error {291 return ioutil.WriteFile(292 filepath.Join(testDir, pkgATestFileAPath),293 pkgATestFileUpdate, 0600)294 },295 tearDown: func() error {296 return gitCmdRun("commit", "-am", "commit changes") // Test297 },298 outTests: []string{"cover-strategy-test-run/pkga.TestDiv"},299 },300 }301 coverStrategy := setup()302 for i, tc := range cases {303 // setup()304 execTestHelper(t, i, tc.desc, tc.setup)305 _, testsList, _, err := coverStrategy.TestsToRun(context.Background())306 // teardown()307 execTestHelper(t, i, tc.desc, tc.tearDown)308 if isUnexpectedErr(t, i, tc.desc, tc.err, err) {309 continue310 }311 // TODO test packages are handled312 sort.Strings(tc.outTests)313 sort.Strings(testsList)314 if !reflect.DeepEqual(tc.outTests, testsList) {315 t.Errorf("case [%d] %s\nexpected Tests %+v\ngot %+v", i, tc.desc, tc.outTests, testsList)316 }317 }318}319func TestFindAllTestInDir(t *testing.T) {...

Full Screen

Full Screen

example_test.go

Source:example_test.go Github

copy

Full Screen

...16 // github.com/pkg/errors_test.ExampleNew_printf17 // /home/dfc/src/github.com/pkg/errors/example_test.go:1718 // testing.runExample19 // /home/dfc/go/src/testing/example.go:11420 // testing.RunExamples21 // /home/dfc/go/src/testing/example.go:3822 // testing.(*M).Run23 // /home/dfc/go/src/testing/testing.go:74424 // main.main25 // /github.com/pkg/errors/_test/_testmain.go:10626 // runtime.main27 // /home/dfc/go/src/runtime/proc.go:18328 // runtime.goexit29 // /home/dfc/go/src/runtime/asm_amd64.s:205930}31func ExampleWithMessage() {32 cause := errors.New("whoops")33 err := errors.WithMessage(cause, "oh noes")34 fmt.Println(err)35 // Output: oh noes: whoops36}37func ExampleWithStack() {38 cause := errors.New("whoops")39 err := errors.WithStack(cause)40 fmt.Println(err)41 // Output: whoops42}43func ExampleWithStack_printf() {44 cause := errors.New("whoops")45 err := errors.WithStack(cause)46 fmt.Printf("%+v", err)47 // Example Output:48 // whoops49 // github.com/pkg/errors_test.ExampleWithStack_printf50 // /home/fabstu/go/src/github.com/pkg/errors/example_test.go:5551 // testing.runExample52 // /usr/lib/go/src/testing/example.go:11453 // testing.RunExamples54 // /usr/lib/go/src/testing/example.go:3855 // testing.(*M).Run56 // /usr/lib/go/src/testing/testing.go:74457 // main.main58 // github.com/pkg/errors/_test/_testmain.go:10659 // runtime.main60 // /usr/lib/go/src/runtime/proc.go:18361 // runtime.goexit62 // /usr/lib/go/src/runtime/asm_amd64.s:208663 // github.com/pkg/errors_test.ExampleWithStack_printf64 // /home/fabstu/go/src/github.com/pkg/errors/example_test.go:5665 // testing.runExample66 // /usr/lib/go/src/testing/example.go:11467 // testing.RunExamples68 // /usr/lib/go/src/testing/example.go:3869 // testing.(*M).Run70 // /usr/lib/go/src/testing/testing.go:74471 // main.main72 // github.com/pkg/errors/_test/_testmain.go:10673 // runtime.main74 // /usr/lib/go/src/runtime/proc.go:18375 // runtime.goexit76 // /usr/lib/go/src/runtime/asm_amd64.s:208677}78func ExampleWrap() {79 cause := errors.New("whoops")80 err := errors.Wrap(cause, "oh noes")81 fmt.Println(err)82 // Output: oh noes: whoops83}84func fn() error {85 e1 := errors.New("error")86 e2 := errors.Wrap(e1, "inner")87 e3 := errors.Wrap(e2, "middle")88 return errors.Wrap(e3, "outer")89}90func ExampleCause() {91 err := fn()92 fmt.Println(err)93 fmt.Println(errors.Cause(err))94 // Output: outer: middle: inner: error95 // error96}97func ExampleWrap_extended() {98 err := fn()99 fmt.Printf("%+v\n", err)100 // Example output:101 // error102 // github.com/pkg/errors_test.fn103 // /home/dfc/src/github.com/pkg/errors/example_test.go:47104 // github.com/pkg/errors_test.ExampleCause_printf105 // /home/dfc/src/github.com/pkg/errors/example_test.go:63106 // testing.runExample107 // /home/dfc/go/src/testing/example.go:114108 // testing.RunExamples109 // /home/dfc/go/src/testing/example.go:38110 // testing.(*M).Run111 // /home/dfc/go/src/testing/testing.go:744112 // main.main113 // /github.com/pkg/errors/_test/_testmain.go:104114 // runtime.main115 // /home/dfc/go/src/runtime/proc.go:183116 // runtime.goexit117 // /home/dfc/go/src/runtime/asm_amd64.s:2059118 // github.com/pkg/errors_test.fn119 // /home/dfc/src/github.com/pkg/errors/example_test.go:48: inner120 // github.com/pkg/errors_test.fn121 // /home/dfc/src/github.com/pkg/errors/example_test.go:49: middle122 // github.com/pkg/errors_test.fn123 // /home/dfc/src/github.com/pkg/errors/example_test.go:50: outer124}125func ExampleWrapf() {126 cause := errors.New("whoops")127 err := errors.Wrapf(cause, "oh noes #%d", 2)128 fmt.Println(err)129 // Output: oh noes #2: whoops130}131func ExampleErrorf_extended() {132 err := errors.Errorf("whoops: %s", "foo")133 fmt.Printf("%+v", err)134 // Example output:135 // whoops: foo136 // github.com/pkg/errors_test.ExampleErrorf137 // /home/dfc/src/github.com/pkg/errors/example_test.go:101138 // testing.runExample139 // /home/dfc/go/src/testing/example.go:114140 // testing.RunExamples141 // /home/dfc/go/src/testing/example.go:38142 // testing.(*M).Run143 // /home/dfc/go/src/testing/testing.go:744144 // main.main145 // /github.com/pkg/errors/_test/_testmain.go:102146 // runtime.main147 // /home/dfc/go/src/runtime/proc.go:183148 // runtime.goexit149 // /home/dfc/go/src/runtime/asm_amd64.s:2059150}151func Example_stackTrace() {152 type stackTracer interface {153 StackTrace() errors.StackTrace154 }155 err, ok := errors.Cause(fn()).(stackTracer)156 if !ok {...

Full Screen

Full Screen

main.go

Source:main.go Github

copy

Full Screen

1// Copyright © 2018 Inanc Gumus2// Learn Go Programming Course3// License: https://creativecommons.org/licenses/by-nc-sa/4.0/4//5// For more tutorials : https://learngoprogramming.com6// In-person training : https://www.linkedin.com/in/inancgumus/7// Follow me on twitter: https://twitter.com/inancgumus8package main9import (10 "fmt"11 "os"12 "strings"13 "time"14)15// ---------------------------------------------------------16// EXERCISE: Days in a Month17//18// Print the number of days in a given month.19//20// RESTRICTIONS21// 1. On a leap year, february should print 29. Otherwise, 28.22//23// Set your computer clock to 2020 to see whether it works.24//25// 2. It should work case-insensitive. See below.26//27// Search on Google: golang pkg strings ToLower28//29// 3. Get the current year using the time.Now()30//31// Search on Google: golang pkg time now year32//33//34// EXPECTED OUTPUT35//36// -----------------------------------------37// Your solution should not accept invalid months38// -----------------------------------------39// go run main.go40// Give me a month name41//42// go run main.go sheep43// "sheep" is not a month.44//45// -----------------------------------------46// Your solution should handle the leap years47// -----------------------------------------48// go run main.go january49// "january" has 31 days.50//51// go run main.go february52// "february" has 28 days.53//54// go run main.go march55// "march" has 31 days.56//57// go run main.go april58// "april" has 30 days.59//60// go run main.go may61// "may" has 31 days.62//63// go run main.go june64// "june" has 30 days.65//66// go run main.go july67// "july" has 31 days.68//69// go run main.go august70// "august" has 31 days.71//72// go run main.go september73// "september" has 30 days.74//75// go run main.go october76// "october" has 31 days.77//78// go run main.go november79// "november" has 30 days.80//81// go run main.go december82// "december" has 31 days.83//84// -----------------------------------------85// Your solution should be case insensitive86// -----------------------------------------87// go run main.go DECEMBER88// "DECEMBER" has 31 days.89//90// go run main.go dEcEmBeR91// "dEcEmBeR" has 31 days.92// ---------------------------------------------------------93func main() {94 a := os.Args95 l := len(a)96 y := time.Now().Year()97 if l < 2 {98 fmt.Println("Give me a month name.")99 }100 numberDays := 28101 leapYear := y%4 == 0 && (y%100 != 0 || y%400 != 0)102 if m := strings.ToLower(a[1]); m == "april" ||103 m == "june" ||104 m == "september" ||105 m == "november" {106 numberDays = 30107 } else if m == "january" ||108 m == "march" ||109 m == "may" ||110 m == "july" ||111 m == "august" ||112 m == "october" ||113 m == "december" {114 numberDays = 31115 } else if m == "february" && leapYear {116 numberDays = 29117 } else {118 fmt.Printf("%q is not a month.\n", a[1])119 return120 }121 fmt.Printf("%q has %d days .\n", a[1], numberDays)122}...

Full Screen

Full Screen

run.go

Source:run.go Github

copy

Full Screen

...3 "github.com/faiface/mainthread"4 "github.com/go-gl/glfw/v3.3/glfw"5 "github.com/pkg/errors"6)7// Run is essentially the main function of PixelGL. It exists mainly due to the technical8// limitations of OpenGL and operating systems. In short, all graphics and window manipulating calls9// must be done from the main thread. Run makes this possible.10//11// Call this function from the main function of your application. This is necessary, so that Run12// runs on the main thread.13//14// func run() {15// // interact with Pixel and PixelGL from here (even concurrently)16// }17//18// func main() {19// pixel.Run(run)20// }21//22// You can spawn any number of goroutines from your run function and interact with PixelGL23// concurrently. The only condition is that the Run function is called from your main function.24func Run(run func()) {25 err := glfw.Init()26 if err != nil {27 panic(errors.Wrap(err, "failed to initialize GLFW"))28 }29 defer glfw.Terminate()30 mainthread.Run(run)31}...

Full Screen

Full Screen

Run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("go", "run", "1.go")4 err := cmd.Run()5 if err != nil {6 fmt.Println(err)7 }8}

Full Screen

Full Screen

Run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("go", "run", "1.go")4 stdout, err := cmd.StdoutPipe()5 if err != nil {6 fmt.Println(err)7 }8 if err := cmd.Start(); err != nil {9 fmt.Println(err)10 }11 output := make([]byte, 1024)12 for {13 n, err := stdout.Read(output)14 if err != nil {15 fmt.Println(err)16 }17 fmt.Println(string(output[:n]))18 }19 if err := cmd.Wait(); err != nil {20 fmt.Println(err)21 }22}23Run() method24func (c *Cmd) Run() error25Start() method26func (c *Cmd) Start() error27Wait() method28Wait() method is used to wait for the command to exit. It must have been started by Start. The returned error is nil if the command runs, has no problems copying stdin, stdout, and stderr, and exits with a zero exit status

Full Screen

Full Screen

Run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("go", "run", "1.go")4 err := cmd.Run()5 if err != nil {6 fmt.Println("error occured")7 }8}9import (10func main() {11 output, err := exec.Command("go", "version").Output()12 if err != nil {13 fmt.Println("error occured")14 }15 fmt.Println(string(output))16}17import (18func main() {19 cmd := exec.Command("go", "run", "1.go")20 err := cmd.Start()21 if err != nil {22 fmt.Println("error occured")23 }24 err = cmd.Wait()25 if err != nil {26 fmt.Println("error occured")27 }28}

Full Screen

Full Screen

Run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4}5import (6func TestMain(m *testing.M) {7 m.Run()8}9import (10func main() {11 fmt.Println("Hello World")12}13import (14func TestMain(m *testing.M) {15 m.Run()16}17import (18func main() {19 fmt.Println("Hello World")20}21import (22func TestMain(m *testing.M) {23 m.Run()24}25import (26func main() {27 fmt.Println("Hello World")28}29import (30func TestMain(m *testing.M) {31 m.Run()32}33import (34func main() {35 fmt.Println("Hello World")36}37import (38func TestMain(m *testing.M) {39 m.Run()40}41import (42func main() {43 fmt.Println("Hello World")44}45import (46func TestMain(m *testing.M) {47 m.Run()48}49import (

Full Screen

Full Screen

Run

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 fmt.Println("Hi")4}5import "fmt"6func main() {7 fmt.Println("Hello")8}9import "fmt"10func main() {11 fmt.Println("Bye")12}13import "fmt"14func main() {15 fmt.Println("Hello World")16}

Full Screen

Full Screen

Run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("main() started")4 cmd := exec.Command("./1.exe")5 cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}6 err := cmd.Run()7 if err != nil {8 log.Fatal(err)9 }10}11main() started12main() ended

Full Screen

Full Screen

Run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 runtime.GOMAXPROCS(1)4 wg.Add(2)5 fmt.Println("Start Goroutines")6 go func() {7 defer wg.Done()8 for count := 0; count < 3; count++ {9 for char := 'a'; char < 'a'+26; char++ {10 fmt.Printf("%c ", char)11 }12 }13 }()14 go func() {15 defer wg.Done()16 for count := 0; count < 3; count++ {17 for char := 'A'; char < 'A'+26; char++ {18 fmt.Printf("%c ", char)19 }20 }21 }()22 fmt.Println("Waiting to finish")23 wg.Wait()24 fmt.Println("\nTerminating Program")25}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Syzkaller automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful