Fix lint errors
This commit is contained in:
parent
815a8180da
commit
6df313558d
@ -341,13 +341,34 @@ linters-settings:
|
|||||||
|
|
||||||
|
|
||||||
depguard:
|
depguard:
|
||||||
list-type: blacklist
|
# Rules to apply.
|
||||||
include-go-root: true
|
#
|
||||||
packages:
|
# Variables:
|
||||||
- io/ioutil
|
# - File Variables
|
||||||
packages-with-error-message:
|
# you can still use and exclamation mark ! in front of a variable to say not to use it.
|
||||||
# specify an error message to output when a blacklisted package is used
|
# Example !$test will match any file that is not a go test file.
|
||||||
- io/ioutil: "replace with the matching functions from `io` or `os` packages"
|
#
|
||||||
|
# `$all` - matches all go files
|
||||||
|
# `$test` - matches all go test files
|
||||||
|
#
|
||||||
|
# - Package Variables
|
||||||
|
#
|
||||||
|
# `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
|
||||||
|
#
|
||||||
|
# Default: no rules.
|
||||||
|
rules:
|
||||||
|
# Name of a rule.
|
||||||
|
main:
|
||||||
|
# List of allowed packages.
|
||||||
|
# allow:
|
||||||
|
# - $gostd
|
||||||
|
# - $all
|
||||||
|
# Packages that are not allowed where the value is a suggestion.
|
||||||
|
deny:
|
||||||
|
- pkg: io/ioutil
|
||||||
|
desc: "replace with the matching functions from `io` or `os` packages"
|
||||||
|
- pkg: "github.com/pkg/errors"
|
||||||
|
desc: Should be replaced by standard lib errors package
|
||||||
|
|
||||||
# ifshort:
|
# ifshort:
|
||||||
# # Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
|
# # Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
|
||||||
|
@ -25,7 +25,10 @@ func (p Profile) SaveTweet(t scraper.Tweet) error {
|
|||||||
insert into tweets (id, user_id, text, posted_at, num_likes, num_retweets, num_replies, num_quote_tweets, in_reply_to_id,
|
insert into tweets (id, user_id, text, posted_at, num_likes, num_retweets, num_replies, num_quote_tweets, in_reply_to_id,
|
||||||
quoted_tweet_id, mentions, reply_mentions, hashtags, space_id, tombstone_type, is_stub, is_content_downloaded,
|
quoted_tweet_id, mentions, reply_mentions, hashtags, space_id, tombstone_type, is_stub, is_content_downloaded,
|
||||||
is_conversation_scraped, last_scraped_at)
|
is_conversation_scraped, last_scraped_at)
|
||||||
values (:id, :user_id, :text, :posted_at, :num_likes, :num_retweets, :num_replies, :num_quote_tweets, :in_reply_to_id, :quoted_tweet_id, :mentions, :reply_mentions, :hashtags, nullif(:space_id, ''), (select rowid from tombstone_types where short_name=:tombstone_type), :is_stub, :is_content_downloaded, :is_conversation_scraped, :last_scraped_at)
|
values (:id, :user_id, :text, :posted_at, :num_likes, :num_retweets, :num_replies, :num_quote_tweets, :in_reply_to_id,
|
||||||
|
:quoted_tweet_id, :mentions, :reply_mentions, :hashtags, nullif(:space_id, ''),
|
||||||
|
(select rowid from tombstone_types where short_name=:tombstone_type), :is_stub, :is_content_downloaded,
|
||||||
|
:is_conversation_scraped, :last_scraped_at)
|
||||||
on conflict do update
|
on conflict do update
|
||||||
set text=(case
|
set text=(case
|
||||||
when is_stub then
|
when is_stub then
|
||||||
@ -115,8 +118,8 @@ func (p Profile) GetTweetById(id scraper.TweetID) (scraper.Tweet, error) {
|
|||||||
var t scraper.Tweet
|
var t scraper.Tweet
|
||||||
err := db.Get(&t, `
|
err := db.Get(&t, `
|
||||||
select id, user_id, text, posted_at, num_likes, num_retweets, num_replies, num_quote_tweets, in_reply_to_id, quoted_tweet_id,
|
select id, user_id, text, posted_at, num_likes, num_retweets, num_replies, num_quote_tweets, in_reply_to_id, quoted_tweet_id,
|
||||||
mentions, reply_mentions, hashtags, ifnull(space_id, '') space_id, ifnull(tombstone_types.short_name, "") tombstone_type, is_stub,
|
mentions, reply_mentions, hashtags, ifnull(space_id, '') space_id, ifnull(tombstone_types.short_name, "") tombstone_type,
|
||||||
is_content_downloaded, is_conversation_scraped, last_scraped_at
|
is_stub, is_content_downloaded, is_conversation_scraped, last_scraped_at
|
||||||
from tweets left join tombstone_types on tweets.tombstone_type = tombstone_types.rowid
|
from tweets left join tombstone_types on tweets.tombstone_type = tombstone_types.rowid
|
||||||
where id = ?
|
where id = ?
|
||||||
`, id)
|
`, id)
|
||||||
|
@ -17,9 +17,9 @@ type CommaSeparatedList []string
|
|||||||
|
|
||||||
func (l *CommaSeparatedList) Scan(src interface{}) error {
|
func (l *CommaSeparatedList) Scan(src interface{}) error {
|
||||||
*l = CommaSeparatedList{}
|
*l = CommaSeparatedList{}
|
||||||
switch src.(type) {
|
switch src := src.(type) {
|
||||||
case string:
|
case string:
|
||||||
for _, v := range strings.Split(src.(string), ",") {
|
for _, v := range strings.Split(src, ",") {
|
||||||
if v != "" {
|
if v != "" {
|
||||||
*l = append(*l, v)
|
*l = append(*l, v)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user