1

When I type "go get ./..." I get back:

./main.go:191: undefined: sendgrid.NewSendGridClientWithApiKey
./main.go:192: undefined: sendgrid.NewMail
./main.go:222: undefined: sendgrid.NewSendGridClientWithApiKey
./main.go:223: undefined: sendgrid.NewMail

How can I fix this error? Or how can I debug this? It is for an older version of go...version 1.5.2..if that helps. Please let me know if I can provide other information. I really do not know where to start as it works fine locally as is. Thanks in advance.

Mee
  • 139
  • 2
  • 9
  • 1
    Start with `go get -v ./...` to see any errors or details. Go get should recursively download dependencies in the `import` section... I suspect the dependency for sendgrid has changed or is no longer valid. – John Weldon Mar 23 '17 at 23:25
  • yeaa...Ill have to check the versioning... -v returned exactly the same thing. thanks for the help. I will update soon after reading more sendgrid docs. – Mee Mar 23 '17 at 23:55
  • Hmm..it doesnt seem to be that...also running go ./.. locally works just fine as is....any help is much appreciated...I am not good with ubuntu it looks like. – Mee Mar 24 '17 at 00:07
  • `-v` is verbose, not version. The reason it works locally is that you still have the older version of the sendgrid library in your GOPATH. The new version that gets fetched automatically would give those errors: https://github.com/sendgrid/sendgrid-go/issues/81 – John Weldon Mar 24 '17 at 00:20

1 Answers1

2

Sendgrid changed their API somewhat recently *.

The reason it works locally is almost certainly because you had the old version of the go library in your GOPATH... using go get -v -u ./... (updating the dependencies) locally will probably break it locally too.

You can fix it either by updating your code to match the new API, or by fixing your dependencies by vendoring the old version.

John Weldon
  • 39,849
  • 11
  • 94
  • 127