Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamdecaf/xmlencoderclose
Go linter to check xml.Encoders are closed
https://github.com/adamdecaf/xmlencoderclose
encoder go-linter golangci-lint xml
Last synced: 30 days ago
JSON representation
Go linter to check xml.Encoders are closed
- Host: GitHub
- URL: https://github.com/adamdecaf/xmlencoderclose
- Owner: adamdecaf
- License: apache-2.0
- Created: 2023-06-07T22:05:01.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-08T22:39:04.000Z (about 2 months ago)
- Last Synced: 2024-11-08T23:26:39.740Z (about 2 months ago)
- Topics: encoder, go-linter, golangci-lint, xml
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xmlencoderclose
[![GoDoc](https://godoc.org/github.com/adamdecaf/xmlencoderclose?status.svg)](https://godoc.org/github.com/adamdecaf/xmlencoderclose)
[![Build Status](https://github.com/adamdecaf/xmlencoderclose/workflows/Go/badge.svg)](https://github.com/adamdecaf/xmlencoderclose/actions)
[![Coverage Status](https://codecov.io/gh/adamdecaf/xmlencoderclose/branch/master/graph/badge.svg)](https://codecov.io/gh/adamdecaf/xmlencoderclose)
[![Go Report Card](https://goreportcard.com/badge/github.com/adamdecaf/xmlencoderclose)](https://goreportcard.com/report/github.com/adamdecaf/xmlencoderclose)
[![Apache 2 License](https://img.shields.io/badge/license-Apache2-blue.svg)](https://raw.githubusercontent.com/adamdecaf/xmlencoderclose/master/LICENSE)xmlencoderclose is a Go linter to check that `encoding/xml.Encoder` type has its `Close()` method called. This linter is similar to [`bodyclose`](https://github.com/timakin/bodyclose) and [`sqlclosecheck`](https://github.com/ryanrolds/sqlclosecheck) with inspiration from [gostaticanalysis/sqlrows](https://github.com/gostaticanalysis/sqlrows)
## Install
```
go get github.com/adamdecaf/xmlencoderclose
```## Example
```go
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](LICENSE) for details.