MCPcopy Index your code
hub / github.com/1995parham/linkedlist

github.com/1995parham/linkedlist @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
68 symbols 192 edges 7 files 10 documented · 15%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Linked List, in Go

GitHub Workflow Status GitHub go.mod Go version (subdirectory of monorepo) Codecov

As you know generics will come to go 1.18 and one of the major drawbacks in go was implementing data structure because of the lack of generics. I implemented a small generic linked list in go and I think we can start having brand new data structures in Go.

~gotip~

First of all you need to install the master version of golang and for this you can use gotip.

go install golang.org/dl/gotip@latest
gotip download

then you can use the gotip command as your normal go command.

Examples

func main() {
        l := list.New[int]()

        l.PushFront(10)
        l.PushFront(20)
        l.PushFront(40)

        fmt.Println(l)
}
func main() {
        l := list.New[string]()

        l.PushFront("hello")

        fmt.Println(l)
}
func main() {
        l := list.New[int]()

        l.PushFront(10)
        l.PushFront(20)
        l.PushFront(40)
        l.PushFront(42)

        fmt.Println(l)

        s := l.Filter(func(i int) bool {
                return i%10 == 0
        })

        fmt.Println(s)
}

Related Issues

Extension points exported contracts — how you extend this code

Comparable (Interface)
Comparable is a recursive generic constraint (Go 1.26) that requires types to be comparable with themselves.
pkg/list/sorted.go
Node (Interface)
Node interface defines an interface for nodes in the linked list so we can iterate them easier.
pkg/list/node.go
Linker (Interface)
(no doc)
pkg/list/node.go

Core symbols most depended-on inside this repo

Insert
called by 28
pkg/list/sorted.go
PushBack
called by 26
pkg/list/list.go
Collect
called by 16
pkg/list/list.go
Values
called by 10
pkg/list/list.go
next
called by 8
pkg/list/node.go
data
called by 8
pkg/list/node.go
setNext
called by 6
pkg/list/node.go
valid
called by 6
pkg/list/node.go

Shape

Method 34
Function 25
Struct 4
Interface 3
TypeAlias 2

Languages

Go100%

Modules by API surface

pkg/list/node.go21 symbols
pkg/list/list.go12 symbols
pkg/list/sorted.go11 symbols
pkg/list/list_test.go10 symbols
pkg/list/sorted_test.go9 symbols
main.go3 symbols
pkg/list/node_test.go2 symbols

For agents

$ claude mcp add linkedlist \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact