Skip to content

x/tools/go/analysis/passes/modernize: replace unsafe pointer arithmetic with unsafe.Add(ptr, n) #76648

@adonovan

Description

@adonovan

@drchase had the idea of a modernizer to replace unsafe pointer arithmetic expressions such as

(*T)(unsafe.Pointer(uintptr(unsafe.Pointer(ptr)) + uintptr(n)))

by calls to helper functions in the unsafe package, such as

unsafe.Add(ptr, n)

We should implement it. Other functions include String, StringData, Slice, and SliceData.

Metadata

Metadata

Assignees

Labels

FeatureRequestIssues asking for a new feature that does not need a proposal.ToolsThis label describes issues relating to any tools in the x/tools repository.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions