excelize: Version compatibility issue: Unable to write any cells under golang 1.21.0.

Description

This morning, after an automatic upgrade to 1.21.0, I noticed that excelize is unable to write any cells, even using the examples from the official readme. The sheets, however, appear to be functioning normally. There are no error messages during the usage of SetCellValue and SaveAs, but the cell contents remain blank.

I didn’t make any code changes; I simply replaced go build with go1.20.7 build and everything returned to normal.

Environment details (OS, Microsoft Excel™ version, physical, etc.): Ubuntu 22.04 LibreOffice 7.3.7.2 Intel 9700K

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 16
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Thanks for your issue. This was similar with #1465, #1595. There are some incompatible changes in the Go 1.21 encoding/xml library. I have given feedback to the Go team and created a patch for it, and still waiting for a reply. Please apply the patchsets in the CL https://go.dev/cl/466295 if you can.

Since vendoring Go 1.16.15 encoding/xml will introduce security issues CVE-2022-28131 (fixed in the go1.18.4) and CVE-2022-30633 (fixed in the go1.18.10), so I suggest waiting for the next Go minor releases or vendoring Go 1.18.10 encoding/xml (made the Excelize require minimum Go version to Go 1.18).

The Go 1.21.1 is released, this issue has been fixed.

@xuri I’m using StreamWriter. It seems to be working fine at the moment but does StreamWriter have the same problem?

Yes, I suggest using the Go 1.20.7 and previous Go released version or waiting for the next Go minor releases.

I have vendoring Go 1.16.15’s encoding/xml package in github.com/xuri/xml, I will use it in the Excelize instead of encoding/xml standard library tomorrow, after that, you can upgrade the Excelize library with the master branch code, and these changes will be released in the next Excelize version, if Go 1.21.1 not yet released.

Is it compatible with go1.21? It will be a long time before the official merger. Projects that rely on excelize will not be able to use go1.21

Hi @fifsky, I noticed that the Go team has added golang/go#62051 to the Go1.21.1 milestone, so I suggest waiting for the next minor releases, and you can vendoring the Go encoding/xml package by yourself if you need to.