gen
gen copied to clipboard
Unused imports added to models causes compilation to fail
Library version master@bac0f1d.
Outputs incorrect version number:
$ gen --version
v0.9.27 (08/04/2020)
Generates models with unused imports:
import (
"database/sql" // unused
"time"
"github.com/satori/go.uuid" // unused
"gorm.io/gorm"
)
Causes compilation to fail:
# <redacted>/model
<redacted>.go:4:2: imported and not used: "database/sql"
<redacted>.go:5:2: imported and not used: "time"
<redacted>.go:7:2: imported and not used: "github.com/satori/go.uuid" as uuid
<redacted>.go:4:2: imported and not used: "database/sql"
<redacted>.go:5:2: imported and not used: "time"
<redacted>.go:7:2: imported and not used: "github.com/satori/go.uuid" as uuid
<redacted>.go:4:2: imported and not used: "database/sql"
<redacted>.go:5:2: imported and not used: "time"
<redacted>.go:7:2: imported and not used: "github.com/satori/go.uuid" as uuid
<redacted>.go:4:2: imported and not used: "database/sql"
<redacted>.go:4:2: too many errors
Compilation finished with exit code 2
Goland complains, but allows me to optimise the imports for all the models, fixing the issue:
