modulepackage
0.2.2
Repository: https://github.com/adamdecaf/xmlencoderclose.git
Documentation: pkg.go.dev
# README
xmlencoderclose
xmlencoderclose is a Go linter to check that encoding/xml.Encoder
type has its Close()
method called. This linter is similar to bodyclose
and sqlclosecheck
with inspiration from gostaticanalysis/sqlrows
Install
go get github.com/adamdecaf/xmlencoderclose
Example
type Document struct {
A string `xml:"a"`
}
func Encode() (string, error) {
var buf bytes.Buffer
err := xml.NewEncoder(&buf).Encode(Document{ // want "Encoder.Close must be called"
A: "abc123",
})
if err != nil {
return "", err
}
return buf.String(), nil
}
Supported and tested platforms
- 64-bit Linux (Ubuntu, Debian), macOS, and Windows
License
Apache License 2.0 - See LICENSE for details.