I'm trying to use this Golang Yelp API package. In some of its structs, it uses types defined in guregu's null package.
I want to declare a struct defined in the Yelp API package, where some of its fields have null.Float
as a value (i.e. this struct, which im trying to use). So in my program, I import both the Yelp API package and guregu's null package and try to declare the struct, with ip.Lat and ip.Lat being float64s. (null.FloatFrom
definition):
33 locationOptions := yelp.LocationOptions{
34 ip.Zip,
35 &yelp.CoordinateOptions{
36 Latitude: null.FloatFrom(ip.Lat),
37 Longitude: null.FloatFrom(ip.Lon),
38 },
39 }
But when I run the program, it tells me:
./cli.go:36: cannot use "github.com/guregu/null".FloatFrom(ip.Lat) (type
"github.com/guregu/null".Float) as type "github.com/JustinBeckwith/go-
yelp/yelp/vendor/github.com/guregu/null".Float in field value
I tried 2 things:
1) I did not import the null
package, which caused Go to complain about null
being undefined. 2) I also tried importing the vendored package directly, which caused Go to tell me use of vendored package not allowed
.
Any Ideas on how to fix this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…