sortmigrate

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package sortmigrate defines an analyzer that detects deprecated sort package function calls that can be replaced with slices package equivalents.

Analyzer sortmigrate

sortmigrate: detect sort.Xyz calls that can use slices equivalents

This analyzer flags calls to deprecated sort package functions:

  • sort.Strings(s) -> slices.Sort(s)
  • sort.Ints(s) -> slices.Sort(s)
  • sort.Float64s(s) -> slices.Sort(s)
  • sort.Slice(s, less) -> slices.SortFunc(s, cmp)
  • sort.SliceStable(s, less) -> slices.SortStableFunc(s, cmp)
  • sort.SliceIsSorted(s, less) -> slices.IsSortedFunc(s, cmp)
  • sort.IntsAreSorted(s) -> slices.IsSorted(s)
  • sort.StringsAreSorted(s) -> slices.IsSorted(s)
  • sort.Float64sAreSorted(s) -> slices.IsSorted(s)

Available since Go 1.21.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "sortmigrate",
	Doc:      "detect sort.Xyz calls that can use slices equivalents",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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