diff --git a/adapter/mysql/adapter_test.go b/adapter/mysql/adapter_test.go index c041d96..3a7dd5f 100644 --- a/adapter/mysql/adapter_test.go +++ b/adapter/mysql/adapter_test.go @@ -34,7 +34,7 @@ func withDatabase(callback func(*Adapter)) { panic(err) } - defer close() + defer close() //nolint:errcheck adapter.db.MustExec("DROP TABLE IF EXISTS followers;") adapter.db.MustExec("DROP TABLE IF EXISTS articles;") diff --git a/adapter/oracle/adapter_test.go b/adapter/oracle/adapter_test.go index d2ad5b0..33f0caa 100644 --- a/adapter/oracle/adapter_test.go +++ b/adapter/oracle/adapter_test.go @@ -32,7 +32,7 @@ func withDatabase(callback func(*Adapter)) { panic(err) } - defer close() + defer close() //nolint:errcheck // adapter.db.MustExec("DROP TABLE followers") // adapter.db.MustExec("DROP TABLE articles") diff --git a/adapter/postgresql/adapter_test.go b/adapter/postgresql/adapter_test.go index 079921f..2b2b1bf 100644 --- a/adapter/postgresql/adapter_test.go +++ b/adapter/postgresql/adapter_test.go @@ -32,7 +32,7 @@ func withDatabase(callback func(*Adapter)) { panic(err) } - defer close() + defer close() //nolint:errcheck adapter.db.MustExec("DROP TABLE IF EXISTS followers;") adapter.db.MustExec("DROP TABLE IF EXISTS articles;") diff --git a/adapter/sqlite3/adapter_test.go b/adapter/sqlite3/adapter_test.go index 12d6adf..a9aec2f 100644 --- a/adapter/sqlite3/adapter_test.go +++ b/adapter/sqlite3/adapter_test.go @@ -14,7 +14,7 @@ func withDatabase(callback func(*Adapter)) { panic(err) } - defer close() + defer close() //nolint:errcheck adapter.DB.MustExec("PRAGMA foreign_keys = ON;") diff --git a/cmd/plant_erd-oracle/main.go b/cmd/plant_erd-oracle/main.go index 0e15372..b71b983 100644 --- a/cmd/plant_erd-oracle/main.go +++ b/cmd/plant_erd-oracle/main.go @@ -82,7 +82,7 @@ func main() { return errors.WithStack(err) } - return generator.Run(schema) + return generator.Run(schema) //nolint:errcheck } sort.Sort(cli.CommandsByName(app.Commands)) diff --git a/cmd/plant_erd/main.go b/cmd/plant_erd/main.go index 3554d92..5efbbde 100644 --- a/cmd/plant_erd/main.go +++ b/cmd/plant_erd/main.go @@ -67,7 +67,7 @@ func main() { return errors.WithStack(err) } - return generator.Run(schema) + return generator.Run(schema) //nolint:errcheck }, }, { @@ -135,7 +135,7 @@ func main() { return errors.WithStack(err) } - return generator.Run(schema) + return generator.Run(schema) //nolint:errcheck }, }, { @@ -199,7 +199,7 @@ func main() { return errors.WithStack(err) } - return generator.Run(schema) + return generator.Run(schema) //nolint:errcheck }, }, } diff --git a/lib/erd_generator_test.go b/lib/erd_generator_test.go index 7c4271c..71b43ae 100644 --- a/lib/erd_generator_test.go +++ b/lib/erd_generator_test.go @@ -2,6 +2,7 @@ package lib import ( "bytes" + "github.com/stretchr/testify/require" "io" "os" "path/filepath" @@ -214,7 +215,8 @@ func TestErdGenerator_output_ToFile(t *testing.T) { Filepath: filePath, } - g.output("aaa") + err := g.output("aaa") + require.NoError(t, err) data, err := os.ReadFile(filePath) @@ -237,10 +239,16 @@ func captureStdout(f func()) string { f() os.Stdout = stdout - w.Close() + err = w.Close() + if err != nil { + panic(err) + } var buf bytes.Buffer - io.Copy(&buf, r) + _, err = io.Copy(&buf, r) + if err != nil { + panic(err) + } return buf.String() }