cannot use nil as type model.Article in return argument : <p>I have this function which is supposed to query database and return an <code>article</code> if found, and nil if the article is not found:</p>

<pre><code>func GetArticleBySlug(slug string) (model.Article, error) {
    var err error
    var article model.Article
    err = database.SQL.Get(&amp;article, "SELECT * FROM article WHERE slug=? LIMIT 1", slug)
    if err != nil {
        log.Println(err)
        return nil, err //&lt;- Problem here
    }
    return article, nil
}
</code></pre>

<p>Where <code>Article</code> is a struct defined in <code>model</code> package. </p>

<p>But I get this error:</p>

<pre><code>cannot use nil as type model.Article in return argument
</code></pre>

<p>How can I fix this?</p>
