volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

malfunction of imports.all #321

Closed saulortega closed 6 years ago

saulortega commented 6 years ago

What version of SQLBoiler are you using (sqlboiler --version)?

SQLBoiler v3.0.0-rc9

If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)

go:generate sqlboiler psql -d

Imports in all models after normal generation:

import (
    "database/sql"
    "fmt"
    "reflect"
    "strconv"
    "strings"
    "sync"
    "time"

    "github.com/pkg/errors"
    "github.com/volatiletech/sqlboiler/boil"
    "github.com/volatiletech/sqlboiler/queries"
    "github.com/volatiletech/sqlboiler/queries/qm"
    "github.com/volatiletech/sqlboiler/strmangle"
    "gopkg.in/volatiletech/null.v7"
)

Added to toml:

[imports.all]
  standard = ['"gopkg.in/volatiletech/null.v7"']
  third_party = ['"nulo"']

Imports after generation with previous toml config:

import (
    "gopkg.in/volatiletech/null.v7"
    "strconv"
    "time"

    "nulo"
)
aarondl commented 6 years ago

Hey Saul. This is actually working as intended. It functions as a total override not as an addition.

Also third party means "not go standard library" so both null and nulo belong in third party.

Go take a look at imports.go and steal the default "all" as your starting point and then you can add your own. Closing for now. Let me know if there's other problems.

saulortega commented 6 years ago

Oh, now I understand