func docWriter(pdf *gofpdf.Fpdf, idx int) *pdfWriter { pw := new(pdfWriter) pw.pdf = pdf pw.idx = idx if pdf.Ok() { var err error fileStr := fmt.Sprintf("%s/pdf/tutorial%02d.pdf", cnGofpdfDir, idx) pw.fl, err = os.Create(fileStr) if err != nil { pdf.SetErrorf("Error opening output file %s", fileStr) } } return pw }
func docWriter(pdf *gofpdf.Fpdf, idx int) *pdfWriter { pw := new(pdfWriter) pw.pdf = pdf pw.idx = idx if pdf.Ok() { var err error fileStr := fmt.Sprintf("%s\\test_pdf_%02d.pdf", cnGofpdfDir, idx) pw.fl, err = os.Create(fileStr) if err != nil { pdf.SetErrorf("Error opening output file %s", fileStr) } } fileLock1 := Locker{false, "lock#1"} printIsLocked(fileLock1) fileLock1.locked = true printIsLocked(fileLock1) fileLock2 := Locker{true, "lock#2"} printIsLocked(fileLock2) return pw }