Fix lint errors
This commit is contained in:
parent
815a8180da
commit
6df313558d
@ -341,13 +341,34 @@ linters-settings:
|
||||
|
||||
|
||||
depguard:
|
||||
list-type: blacklist
|
||||
include-go-root: true
|
||||
packages:
|
||||
- io/ioutil
|
||||
packages-with-error-message:
|
||||
# specify an error message to output when a blacklisted package is used
|
||||
- io/ioutil: "replace with the matching functions from `io` or `os` packages"
|
||||
# Rules to apply.
|
||||
#
|
||||
# Variables:
|
||||
# - File Variables
|
||||
# you can still use and exclamation mark ! in front of a variable to say not to use it.
|
||||
# Example !$test will match any file that is not a go test file.
|
||||
#
|
||||
# `$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:
|
||||
# # 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,
|
||||
quoted_tweet_id, mentions, reply_mentions, hashtags, space_id, 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)
|
||||
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
|
||||
set text=(case
|
||||
when is_stub then
|
||||
@ -115,8 +118,8 @@ func (p Profile) GetTweetById(id scraper.TweetID) (scraper.Tweet, error) {
|
||||
var t scraper.Tweet
|
||||
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,
|
||||
mentions, reply_mentions, hashtags, ifnull(space_id, '') space_id, ifnull(tombstone_types.short_name, "") tombstone_type, is_stub,
|
||||
is_content_downloaded, is_conversation_scraped, last_scraped_at
|
||||
mentions, reply_mentions, hashtags, ifnull(space_id, '') space_id, ifnull(tombstone_types.short_name, "") tombstone_type,
|
||||
is_stub, is_content_downloaded, is_conversation_scraped, last_scraped_at
|
||||
from tweets left join tombstone_types on tweets.tombstone_type = tombstone_types.rowid
|
||||
where id = ?
|
||||
`, id)
|
||||
|
@ -17,9 +17,9 @@ type CommaSeparatedList []string
|
||||
|
||||
func (l *CommaSeparatedList) Scan(src interface{}) error {
|
||||
*l = CommaSeparatedList{}
|
||||
switch src.(type) {
|
||||
switch src := src.(type) {
|
||||
case string:
|
||||
for _, v := range strings.Split(src.(string), ",") {
|
||||
for _, v := range strings.Split(src, ",") {
|
||||
if v != "" {
|
||||
*l = append(*l, v)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user