Description
Unlike many other programming lanugages, Go doesn't provide helper functions for slices in it's core. I felt like this was quite an essential feature and there weren't any libraries out there that would do this, so I made my own. The functions are the same as the in the Go's official "strings" package, but you can use them on slices.
go-slices alternatives and similar packages
Based on the "Go Tools" category.
Alternatively, view go-slices alternatives based on common mentions on social networks and blogs.
-
JuiceFS
JuiceFS is a distributed POSIX file system built on top of Redis and S3. -
JSON-to-Go
Translates JSON into a Go type in your browser instantly (original) -
kube-prompt
An interactive kubernetes client featuring auto-complete. -
The Go Play Space
Advanced Go Playground frontend written in Go, with syntax highlighting, turtle graphics mode, and more -
Peanut
๐บ Deploy Databases and Services Easily for Development and Testing Pipelines. -
golang-tutorials
Golang Tutorials. Learn Golang from Scratch with simple examples. -
xdg-go
Go implementation of the XDG Base Directory Specification and XDG user directories -
rts
RTS: request to struct. Generates Go structs from JSON server responses. -
typex
[TOOL, CLI] - Filter and examine Go type structures, interfaces and their transitive dependencies and relationships. Export structural types as TypeScript value object or bare type representations. -
golang-ipc
Golang Inter-process communication library for Window, Mac and Linux. -
gothanks
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way to say thanks to the maintainers of the modules you use and the contributors of Go itself. -
zb
an opinionated repo based tool for linting, testing and building go source -
Viney's go-cache
A flexible multi-layer Go caching library to deal with in-memory and shared cache by adopting Cache-Aside pattern. -
go-lock
go-lock is a lock library implementing read-write mutex and read-write trylock without starvation -
goroutines
It is an efficient, flexible, and lightweight goroutine pool. It provides an easy way to deal with concurrent tasks with limited resource. -
gotestdox
A tool for formatting Go test results as readable documentation -
PDF to Image Converter Using Golang
This project will help you to convert PDF file to IMAGE using golang. -
An exit strategy for go routines.
An exit strategy for go routines -
go-james
James is your butler and helps you to create, build, debug, test and run your Go projects -
import "github/shuLhan/share"
A collection of libraries and tools written in Go; including DNS, email, git ini file format, HTTP, memfs (embedding file into Go), paseto, SMTP, TOTP, WebSocket, XMLRPC, and many more. -
generator-go-lang
A Yeoman generator to get new Go projects started. -
go-sanitize
:bathtub: Golang library of simple to use sanitation functions -
docs
Automatically generate RESTful API documentation for GO projects - aligned with Open API Specification standard -
gomodrun
The forgotten go tool that executes and caches binaries included in go.mod files. -
go-whatsonchain
:link: Unofficial golang implementation for the WhatsOnChain API -
channelize
A websocket framework to manage outbound streams. Allowing to have multiple channels per connection that includes public and private channels. -
Proofable
General purpose proving framework for certifying digital assets to public blockchains -
redispubsub
Redis Streams queue driver for https://godoc.org/gocloud.dev/pubsub package -
ciiigo
[mirror] Go static website generator with asciidoc markup language -
MessageBus implementation for CQRS projects
CQRS Implementation for Golang language -
modver
Compare two versions of a Go module to check the version-number change required (major, minor, or patchlevel), according to semver rules.
Learn any GitHub repo in 59 seconds
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of go-slices or a related project?
README
go-slices
Unlike many other programming languages, Go doesn't provide helper functions for slices in it's core. I felt like this was quite an essential feature and there weren't any libraries out there that would do this, so I made my own. The functions are the same as the in the Go's official "strings" package, but you can use them on slices.
How to install
Open your terminal and type:
go get github.com/merkur0/go-slices
Then, import this package in your .go file like this:
import (
"github.com/merkur0/go-slices"
)
And that's it!
Usage:
slices.FunctionName(parameters)
Example:
mySlice := []int{1, 2, 3}
slices.ContainsInt(mySlice, 3) // Returns "true"
List of functions:
Contains
Returns true if the slice contains the item and false if it doesn't. Example:
mySlice := []float32{1.1, 1.2, 1.3, 1.4, 1.5}
slices.ContainsFloat32(myArr, 1.2) // returns true
slices.ContainsFloat32(myArr, 2.3) // returns false
Count
Returns the number of instances of the item within the slice. Example:
mySlice := []int{1, 1, 1, 2, 1}
slices.CountInt(mySlice, 1) // returns 4
slices.CountInt(mySlice, 3) // returns 0
Delete
Returns a copy of the slice where the item with the index (second parameter) is deleted. Example:
mySlice := []int{1, 2, 3, 4, 5}
slices.DeleteInt(mySlice, 0) // returns [2, 3, 4, 5]
Index
Returns the index of the first instance of the second parameter in the slice, or -1 if item is not present in the slice. Example:
mySlice := []int{4, 1, 5}
slices.IndexInt(mySlice, 5) // returns 2
LastIndex
Returns the index of the last instance of the second parameter in the slice, or -1 if item is not present in the slice. Example:
mySlice := []int{1, 2, 1, 1, 4}
slices.LastIndexInt(mySlice, 1) // returns 3
Map
Returns a copy of the slice with all its items modified according to the mapping function. Example:
myFunc := func(number int) int {
return number * 2
}
mySlice := []int{1, 2, 3, 4}
slices.MapInt(mySlice, myFunc) // returns [2, 4, 6, 8]
Max
Returns the largest element in the slice. Example:
mySlice := []int{1, 2, 3, 4}
slices.MaxInt(mySlice) // returns 4
Min
Returns the smallest element in the slice. Example:
mySlice := []int{1, 2, 3, 4}
slices.MinInt(mySlice) // returns 1
Pop
Returns a copy of the slice with it's last item removed. Example:
mySlice := []int{1, 2, 3, 4}
slices.PopInt(mySlice) // returns [1, 2, 3]
Replace
Returns a copy of the slice where the first instance of the old item (second parameter) is replaced with the new item (third parameter). Example:
mySlice := []int{1, 1, 3, 5, 1}
slices.ReplaceInt(mySlice, 1, 0) // returns [0, 1, 3, 5, 1]
ReplaceAll
Returns a copy of the slice where every instance of the old item (second parameter) is replaced with the new item (third parameter) and returns the new slice. Example:
mySlice := []int{1, 1, 3, 5, 1}
slices.ReplaceAllInt(mySlice, 1, 0) // returns [0, 0, 3, 5, 1]
Shift
Returns a copy of the slice with it's first item removed. Example:
mySlice := []int{1, 2, 3}
slices.ShiftInt(mySlice) // returns [2, 3]