Fix lint error
This commit is contained in:
parent
694a8e0bc5
commit
33c8ef30ec
@ -246,12 +246,16 @@ func cursor_to_query_params(c persistence.Cursor) string {
|
|||||||
return result.Encode()
|
return result.Encode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type key string
|
||||||
|
|
||||||
|
const TWEET_KEY = key("tweet")
|
||||||
|
|
||||||
func add_tweet_to_context(ctx context.Context, tweet scraper.Tweet) context.Context {
|
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 {
|
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 {
|
if !is_ok {
|
||||||
panic("Tweet not found in context")
|
panic("Tweet not found in context")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user