clausecker / nfc

Go bindings for the libnfc
https://pkg.go.dev/github.com/clausecker/nfc/v2
GNU Lesser General Public License v3.0
101 stars 20 forks source link

undefined: context #11

Closed sambengtson closed 7 years ago

sambengtson commented 7 years ago

I installed the library using go get

go get github.com/fuzxxl/nfc

I'm receiving a build error that would indicate that I possibly installed the library incorrectly.

../github.com/fuzxxl/nfc/2.0/nfc/nfc.go:206: undefined: context

I tried downloading the root project directly into my GOPATH but am still experiencing the same behavior. Can you advise? I'm sure it's something dumb that I'm overlooking.

abhishek2896 commented 7 years ago

Which Go version are you using. I don't think that if your go version is greater that 1.6 than this should be issue

sambengtson commented 7 years ago

Sorry, I should have specified. Go1.8

abhishek2896 commented 7 years ago

ohh that was stupid of me, this is not that issue. Let me see

hsanjuan commented 7 years ago

go get github.com/fuzxxl/nfc/2.0/nfc works for me...

sambengtson commented 7 years ago

@hsanjuan You don't see anything like this?

sam@sam-VirtualBox:~/Go/src/github.com$ go get github.com/fuzxxl/nfc/2.0/nfc github.com/fuzxxl/nfc/2.0/nfc/nfc.go:206: undefined: context

hsanjuan commented 7 years ago

Ah. This happens to me when trying to compile with CGO_ENABLED=0

Try CGO_ENABLED=1. Since this library is a C binding you probably need to use CGO.

sambengtson commented 7 years ago

@hsanjuan There we go! Thanks!