tweet.Text undefined (type tweet has no method Text)
Closed this issue · 2 comments
jetbasrawi commented
Hi Matt,
When building the twitter app I get this error
./twitter.go:120: tweet.Text undefined (type tweet has no method Text)
type tweet struct {
Text string
}
....
for _, option := range options {
if strings.Contains(
strings.ToLower(tweet.Text),
strings.ToLower(option),
) {
log.Println("vote:", option)
votes <- option
}
}
Really strange. Cant find anything via google that explains this. Have tried using different name for both the tweet struct and the field Text and whichever way I try it its the same. Any ideas?
jetbasrawi commented
Sorry my mistake.
I missed out the declaration of
var tweet tweet
matryer commented
Using the same name for the variable and the type is pretty confusing, so you can be forgiven for this one. :)
On 13 Feb 2016, at 12:34, jetbasrawi notifications@github.com wrote:
Sorry my mistake.
I missed out the declaration of
var tweet tweet
—
Reply to this email directly or view it on GitHub.