弦集 stringset为golang中的字符串创建并发安全的集合 安装 go get -u github.com/axamon/stringset 用法 package main import ( "fmt" "github.com/axamon/stringset" ) func main () { testSet := NewStringSet ( "pippo" , "pluto" , "paperino" , "pippo" ) slice := testSet . Strings () sort . Strings ( slice ) for _ , element := range slice { fmt . Println ( element ) } // Output: // paperino // pippo