xmlencoderclose

command module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

xmlencoderclose

GoDoc Build Status Coverage Status Go Report Card Apache 2 License

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

Given a few example games where players score goals we can combine those to find their total scores.

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL