go-tools icon indicating copy to clipboard operation
go-tools copied to clipboard

SA1019: only first object in a declaration group gets marked as deprecated

Open shmsr opened this issue 3 years ago • 0 comments

Consider the following case:

Reference: https://cs.opensource.google/go/go/+/refs/tags/go1.19:src/os/file.go;l=88

In "os" package, os.SEEK_SET, os.SEEK_CUR and os.SEEK_END are deprecated and are suggested to be replaced with: io.SeekStart, io.SeekCurrent, and io.SeekEnd.

// Seek whence values.
//
// Deprecated: Use io.SeekStart, io.SeekCurrent, and io.SeekEnd.
const (
	SEEK_SET int = 0 // seek relative to the origin of the file
	SEEK_CUR int = 1 // seek relative to the current offset
	SEEK_END int = 2 // seek relative to the end
)

Currently, the fact_deprecated analyzer is unable to detect SEEK_CUR and SEEK_END and just marks SEEK_SET as deprecated.

Because of this bug SA1019 check is also affected (there might be more).

shmsr avatar Aug 19 '22 19:08 shmsr