ent: address several lint errors throughout the project (#1534)

Summary:
Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1534

Pull Request resolved: https://github.com/facebookincubator/ent/pull/73

lint errors detected by running `golangci-lint` tool.

Reviewed By: a8m

Differential Revision: D17784980

fbshipit-source-id: f7e8bd99fdf1e018d5672cea1e8d44b67f2a4201
This commit is contained in:
Alex Snast
2019-10-06 23:58:04 -07:00
committed by Facebook Github Bot
parent b0e889a997
commit ac50ea81d4
26 changed files with 85 additions and 75 deletions

View File

@@ -18,17 +18,18 @@ import (
func TestWriteDriver(t *testing.T) {
b := &bytes.Buffer{}
w := WriteDriver{Driver: nopDriver{}, Writer: b}
tx, err := w.Tx(nil)
ctx := context.Background()
tx, err := w.Tx(ctx)
require.NoError(t, err)
err = tx.Query(nil, "SELECT `name` FROM `users`", nil, nil)
err = tx.Query(ctx, "SELECT `name` FROM `users`", nil, nil)
require.NoError(t, err)
err = tx.Query(nil, "SELECT `name` FROM `users`", nil, nil)
err = tx.Query(ctx, "SELECT `name` FROM `users`", nil, nil)
require.NoError(t, err)
err = tx.Exec(nil, "ALTER TABLE `users` ADD COLUMN `age` int", nil, nil)
err = tx.Exec(ctx, "ALTER TABLE `users` ADD COLUMN `age` int", nil, nil)
require.NoError(t, err)
err = tx.Exec(nil, "ALTER TABLE `users` ADD COLUMN `NAME` varchar(100);", nil, nil)
err = tx.Exec(ctx, "ALTER TABLE `users` ADD COLUMN `NAME` varchar(100);", nil, nil)
require.NoError(t, err)
err = tx.Query(nil, "SELECT `name` FROM `users`", nil, nil)
err = tx.Query(ctx, "SELECT `name` FROM `users`", nil, nil)
require.NoError(t, err)
require.NoError(t, tx.Commit())
lines := strings.Split(b.String(), "\n")