Fix lint error

This commit is contained in:
Alessio 2023-11-05 18:38:38 -04:00
parent 694a8e0bc5
commit 33c8ef30ec

View File

@ -246,12 +246,16 @@ func cursor_to_query_params(c persistence.Cursor) string {
return result.Encode()
}
type key string
const TWEET_KEY = key("tweet")
func add_tweet_to_context(ctx context.Context, tweet scraper.Tweet) context.Context {
return context.WithValue(ctx, "tweet", tweet)
return context.WithValue(ctx, TWEET_KEY, tweet)
}
func get_tweet_from_context(ctx context.Context) scraper.Tweet {
tweet, is_ok := ctx.Value("tweet").(scraper.Tweet)
tweet, is_ok := ctx.Value(TWEET_KEY).(scraper.Tweet)
if !is_ok {
panic("Tweet not found in context")
}