Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you use this? is there a main.go code I can reference? #2

Open
unisqu opened this issue Dec 27, 2017 · 0 comments
Open

How do you use this? is there a main.go code I can reference? #2

unisqu opened this issue Dec 27, 2017 · 0 comments

Comments

@unisqu
Copy link

unisqu commented Dec 27, 2017

I'm trying to try to code but have no idea how to use. Can you please provide the instructions? I've configure make install judy c code. but these codes doesnt run. it says

./main.go:5: imported and not used: "github.com/gnoso/go-judy" as judy
./main.go:16: j.Free undefined (type JudyL has no field or method Free)
./main.go:17: j.Insert undefined (type JudyL has no field or method Insert)
./main.go:18: j.Get undefined (type JudyL has no field or method Get)
./main.go:19: j.Get undefined (type JudyL has no field or method Get)
./main.go:20: j.Delete undefined (type JudyL has no field or method Delete)
./main.go:21: j.Delete undefined (type JudyL has no field or method Delete)

pls help.

package main

import (
                "fmt"
                "github.com/gnoso/go-judy"
       )

type JudyL struct {
    // contains filtered or unexported fields
    uid uint32

}
//var judy JudyL;
func main() {
j := JudyL{} // declare empty JudyL integer map array
   defer j.Free() // make sure the array is freed when finished
           j.Insert(11235, 1123)   // returns true
           val, ok := j.Get(11235) // val == 1123, ok == true
           _, ok = j.Get(1) // ok == false (not found)
           j.Delete(11235) // returns true
           j.Delete(11235) // returns false (doesn't exist)
           fmt.Printf("Hello world! My lucky number is %d", val)

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant