Skip to content

Fix -b, so it doesn't always error #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 30, 2022

Conversation

stuartpa
Copy link
Collaborator

@stuartpa stuartpa commented Jun 22, 2022

Fix for #98

sqlcmd wasn't excepting EOF as a valid state for input, and always returning an exit code 1 when -b is passed in.

Added failing test, that is now passing.

Console repo:

C:\src\go-sqlcmd_1>type sql.bad
select @badvar
C:\src\go-sqlcmd_1>sqlcmd.exe -i sql.bad -r0 -b 2> err.txt

C:\src\go-sqlcmd_1>echo %ERRORLEVEL%
1

C:\src\go-sqlcmd_1>type err.txt
Must declare the scalar variable "@badvar".
C:\src\go-sqlcmd_1>

@stuartpa stuartpa marked this pull request as ready for review June 22, 2022 13:54
@stuartpa stuartpa self-assigned this Jun 22, 2022
@stuartpa stuartpa linked an issue Jun 22, 2022 that may be closed by this pull request
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package main
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this entire file being shown as changed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"hide whitespace" on github works, it's just interesting that whatever you guys use to edit the code is changing whitespace when my vscode does not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goland does run "code reformat" on save by default, which does run go fmt if the option is ticked. (which is ticked on my machine). I'm not sure if its the "code reformat" or the go fmt that is doing it.

https://www.jetbrains.com/help/go/reformat-and-rearrange-code.html#run-the-gofmt-tool-after-the-reformat-action

Copy link
Collaborator

@shueybubbles shueybubbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how we missed the lint problems earlier, can you fix those with this?

@stuartpa
Copy link
Collaborator Author

stuartpa commented Jun 22, 2022

Not sure how we missed the lint problems earlier, can you fix those with this?

Where are those lint failures, I can't see them in the source (and the lint output doesn't output which file the variables are in). I'm guessing they are in sqlcmd.go runQuery(). But those variables look used to me.

Stranger, I'm not seeing these lint failures in PR #100

@stuartpa stuartpa merged commit e6b1b9e into main Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-b option is not working in go-sqlcmd
2 participants