Skip to content

Commit

Permalink
lint: Fix redefines-builtin-id
Browse files Browse the repository at this point in the history
  • Loading branch information
sue445 committed Jul 13, 2024
1 parent eaaf327 commit 03b80cc
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions adapter/mysql/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ func withDatabase(callback func(*Adapter)) {
config.User = os.Getenv("MYSQL_USER")
config.Passwd = os.Getenv("MYSQL_PASSWORD")
config.DBName = os.Getenv("MYSQL_DATABASE")
adapter, close, err := NewAdapter(config)
adapter, closeDatabase, err := NewAdapter(config)

if err != nil {
panic(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

adapter.db.MustExec("DROP TABLE IF EXISTS followers;")
adapter.db.MustExec("DROP TABLE IF EXISTS articles;")
Expand Down
4 changes: 2 additions & 2 deletions adapter/oracle/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func withDatabase(callback func(*Adapter)) {
config.Username = os.Getenv("ORACLE_USER")
config.Password = os.Getenv("ORACLE_PASSWORD")
config.ServiceName = os.Getenv("ORACLE_SERVICE")
adapter, close, err := NewAdapter(config)
adapter, closeDatabase, err := NewAdapter(config)

if err != nil {
panic(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

// adapter.db.MustExec("DROP TABLE followers")
// adapter.db.MustExec("DROP TABLE articles")
Expand Down
4 changes: 2 additions & 2 deletions adapter/postgresql/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func withDatabase(callback func(*Adapter)) {
config.User = os.Getenv("POSTGRES_USER")
config.Password = os.Getenv("POSTGRES_PASSWORD")
config.DBName = os.Getenv("POSTGRES_DATABASE")
adapter, close, err := NewAdapter(config)
adapter, closeDatabase, err := NewAdapter(config)

if err != nil {
panic(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

adapter.db.MustExec("DROP TABLE IF EXISTS followers;")
adapter.db.MustExec("DROP TABLE IF EXISTS articles;")
Expand Down
4 changes: 2 additions & 2 deletions adapter/sqlite3/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (
)

func withDatabase(callback func(*Adapter)) {
adapter, close, err := NewAdapter("file::memory:?cache=shared")
adapter, closeDatabase, err := NewAdapter("file::memory:?cache=shared")

if err != nil {
panic(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

adapter.DB.MustExec("PRAGMA foreign_keys = ON;")

Expand Down
4 changes: 2 additions & 2 deletions cmd/plant_erd-oracle/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ func main() {
)

app.Action = func(_ *cli.Context) error {
adapter, close, err := oracle.NewAdapter(oracleConfig)
adapter, closeDatabase, err := oracle.NewAdapter(oracleConfig)

if err != nil {
return errors.WithStack(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

schema, err := lib.LoadSchema(adapter)
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions cmd/plant_erd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ func main() {
},
),
Action: func(_ *cli.Context) error {
adapter, close, err := sqlite3.NewAdapter(sqlite3Database)
adapter, closeDatabase, err := sqlite3.NewAdapter(sqlite3Database)

if err != nil {
return errors.WithStack(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

schema, err := lib.LoadSchema(adapter)
if err != nil {
Expand Down Expand Up @@ -122,13 +122,13 @@ func main() {
mysqlConfig.Net = "tcp"
mysqlConfig.Addr = fmt.Sprintf("%s:%d", mysqlHost, mysqlPort)

adapter, close, err := mysql.NewAdapter(mysqlConfig)
adapter, closeDatabase, err := mysql.NewAdapter(mysqlConfig)

if err != nil {
return errors.WithStack(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

schema, err := lib.LoadSchema(adapter)
if err != nil {
Expand Down Expand Up @@ -186,13 +186,13 @@ func main() {
},
),
Action: func(_ *cli.Context) error {
adapter, close, err := postgresql.NewAdapter(postgresqlConfig)
adapter, closeDatabase, err := postgresql.NewAdapter(postgresqlConfig)

if err != nil {
return errors.WithStack(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

schema, err := lib.LoadSchema(adapter)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions lib/erd_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (
)

func withDatabase(callback func(*sqlite3.Adapter)) {
adapter, close, err := sqlite3.NewAdapter("file::memory:?cache=shared")
adapter, closeDatabase, err := sqlite3.NewAdapter("file::memory:?cache=shared")

if err != nil {
panic(err)
}

defer close() //nolint:errcheck
defer closeDatabase() //nolint:errcheck

adapter.DB.MustExec("PRAGMA foreign_keys = ON;")

Expand Down

0 comments on commit 03b80cc

Please sign in to comment.