Skip to content

2pisoftware/gofor-little-ts

 
 

Repository files navigation

A package for common thread safe data structures

GitHub tag (latest SemVer pre-release) GitHub go.mod Go version License: MIT GitHub Workflow Status Go Report Card PkgGoDev

Introduction

  • Currently supports linked lists and slices
  • No dependencies outside the standard library

Example

package main

import (
	"fmt"

	ts "github.com/2pisoftware/gofor-little-ts"
)

func main() {
    list := ts.LinkedList{}
    list.Push("Some string")

    item := list.GetTail()
    fmt.Println(item)

    item = list.Pop()
    fmt.Println(item)

    slice := ts.Slice{}

    slice.Add(1, 2, 3)
    fmt.Println(slice.GetElements())

    slice.Remove(1, 2, 3)
    fmt.Println(slice.GetElements())
}

Testing

Run go test -v -race ./... in the root directory.