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

undefined: ffjson.DecodeFast #245

Open
bmeh opened this issue Sep 9, 2018 · 3 comments
Open

undefined: ffjson.DecodeFast #245

bmeh opened this issue Sep 9, 2018 · 3 comments

Comments

@bmeh
Copy link

bmeh commented Sep 9, 2018

bmeh@arch test $ cat main.go 
package main

import "github.com/pquerna/ffjson/ffjson"

func main() {
        ffjson.DecodeFast()
}
bmeh@arch test $ 
$ go build
# _/tmp/test
./main.go:6:2: undefined: ffjson.DecodeFast

What am I missing? I double-checked, the version (master) I have downloaded contains DecodeFast in decoder.go.

I ran go vet decoder.go, it says:

# command-line-arguments
./decoder.go:42:14: undefined: unmarshalFaster
./decoder.go:62:14: undefined: unmarshalFaster
./decoder.go:82:14: undefined: unmarshalFaster

Is this library for an outdated version of go?

@erikdubbelboer
Copy link
Contributor

That's because DecodeFast is not a global method in ffjson. It's a method of Decoder. So you need to do something like ffjson.NewDecoder().DecodeFast(). It has arguments as well so that will be your next error if you call it without arguments.

@erikdubbelboer
Copy link
Contributor

Also running go vet on just one file isn't going to work seeing as it depends on other files in the same package as well. Running go vet on the whole package results in no errors or warnings.

@bmeh
Copy link
Author

bmeh commented Sep 9, 2018

Oh, thank you for the clarification!

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

2 participants