Skip to content

Commit

Permalink
update workflows to match geth upstream
Browse files Browse the repository at this point in the history
Signed-off-by: Pranay Valson <[email protected]>
  • Loading branch information
noslav committed Jan 22, 2024
1 parent c903634 commit 374d974
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.6
go-version: 1.21.4

- name: Checkout code
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: i386 linux tests

on:
push:
branches: [ master ]
branches: [main]
pull_request:
branches: [ master ]
branches: [main]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:

- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.2
./bin/golangci-lint run
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.2
# ./bin/golangci-lint run
# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/temp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import (
"strings"
)

type Trie struct {
Root *Node
}

type Node struct {
Val string
Left *Node
Right *Node
}

func Constructor() Trie {
return Trie{}
}

func (this *Trie) Insert(word string) {
this.Root = insert(this.Root, word)
}

func insert(root *Node, word string) {
if root == nil {
return &Node{
Val: word,
}
}
if word < root.Val {
root.LeftNode = insert(root.LeftNode, word)
} else {
root.RightNode = insert(root.RightNode, word)
}
}

func (this *Trie) Search(word string) bool {
return search(this.Root, word)
}

func search(root *Node, word string) {
if root == nil {
return false
}

if root.Val == word {
return true
}

return search(root.Left) || search(root.Right)
}

func (this *Trie) StartsWith(prefix string) bool {
return startsWith(this.Root, prefix)
}

func startsWith(root *Node, prefix string) bool {
if root == nil {
return false
}
if strings.Index(root.Val, prefix) == 0 {
return true
}
return startsWith(root.Left, prefix) || startsWith(root.Right, prefix)
}

/**
* Your Trie object will be instantiated and called as such:
* obj := Constructor();
* obj.Insert(word);
* param_2 := obj.Search(word);
* param_3 := obj.StartsWith(prefix);
*/

0 comments on commit 374d974

Please sign in to comment.