Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/alextuan1024/sorting

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/alextuan1024/sorting

  • v0.0.0-20190516092023-273f262e2357
  • Source
  • Go
  • Socket score

Version published
Created
Source

Golang标准库sort

The GO Programming Language读书笔记,7.6节 改进的自定排序实现 tempflag code from the book

Sort Tracks

包装待排序的切片

type By func(t1, t2 *Track) bool

type TrackSorter struct {
	tracks []*Track
	by     By
}

随后使用包装类型(或其指针)去实现sort.Interface接口

包装的Sort

func (by By) Sort(tracks []*Track) {
	ts := TrackSorter{
		tracks: tracks,
		by:     by,
	}
	sort.Sort(&ts)
}

FAQs

Package last updated on 16 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc