golang/go

x/tools/gopls/internal/analysis: analyzer for slice aliasing mistakes

Ouverte

#73 830 ouverte le 22 mai 2025

 (16 commentaires) (2 réactions) (0 personne assignée)Go (19 008 forks)batch import

Métriques du dépôt

Stars
 (133 883 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

In a discussion about slice aliasing bugs, @randall77 suggested an analyzer that detects "aliasing of two slice variables, where the capacity of the slice is unknown (due to append starting from nil, say), and then an append on each of the aliased slices". We should prototype a simple analyzer to detect this pattern and see what turns up.

Guide contributeur