Skip to content
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

Fix issues reported by golangci-lint #121

Merged
merged 2 commits into from
Jan 22, 2024
Merged

Conversation

dveeden
Copy link
Collaborator

@dveeden dveeden commented Dec 7, 2023

$ golangci-lint run
generate_perror/main.go:148:11: Error return value of `cmd.Wait` is not checked (errcheck)
		cmd.Wait()
		        ^
src/main.go:294:13: Error return value of `t.mdb.Exec` is not checked (errcheck)
		t.mdb.Exec(fmt.Sprintf("drop database `%s`", strings.ReplaceAll(t.name, "/", "__")))
		          ^
src/main.go:921:18: Error return value of `t.curr.conn.Raw` is not checked (errcheck)
		t.curr.conn.Raw(func(driverConn any) error {
		               ^
generate_perror/main.go:173:9: S1005: unnecessary assignment to the blank identifier (gosimple)
	for i, _ := range codes {
	       ^
generate_perror/main.go:81:6: S1009: should omit nil check; len() for []string is defined as zero (gosimple)
		if m != nil && len(m) == 3 && m[1] != "" && m[2] != "" {
		   ^
generate_perror/main.go:137:7: S1009: should omit nil check; len() for []string is defined as zero (gosimple)
			if m != nil && len(m) == 3 && m[1] != "" && m[2] != "" {

```
$ golangci-lint run
generate_perror/main.go:148:11: Error return value of `cmd.Wait` is not checked (errcheck)
		cmd.Wait()
		        ^
src/main.go:294:13: Error return value of `t.mdb.Exec` is not checked (errcheck)
		t.mdb.Exec(fmt.Sprintf("drop database `%s`", strings.ReplaceAll(t.name, "/", "__")))
		          ^
src/main.go:921:18: Error return value of `t.curr.conn.Raw` is not checked (errcheck)
		t.curr.conn.Raw(func(driverConn any) error {
		               ^
generate_perror/main.go:173:9: S1005: unnecessary assignment to the blank identifier (gosimple)
	for i, _ := range codes {
	       ^
generate_perror/main.go:81:6: S1009: should omit nil check; len() for []string is defined as zero (gosimple)
		if m != nil && len(m) == 3 && m[1] != "" && m[2] != "" {
		   ^
generate_perror/main.go:137:7: S1009: should omit nil check; len() for []string is defined as zero (gosimple)
			if m != nil && len(m) == 3 && m[1] != "" && m[2] != "" {
```
@dveeden dveeden requested review from bb7133, wuhuizuo and mjonss December 7, 2023 07:58
@dveeden dveeden mentioned this pull request Dec 7, 2023
@Defined2014
Copy link
Contributor

@bb7133 PTAL

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@bb7133 bb7133 merged commit d5f7166 into pingcap:master Jan 22, 2024
1 check passed
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.

4 participants