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

Fixing github workflow build and linter #13

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

peczenyj
Copy link

@peczenyj peczenyj commented Jan 10, 2025

Hello

The build is failing because of the deprecated github workflow, it try to install a program that requires a newer version of go and it does not work

What I did here:

  1. I format the source code via go fmt and gofumpt (changes almost nothing)
  2. I substitute the .gitignore by one generated by community that include more annoying items
  3. I substitute the actual workflow by two, one to run tests in a version matrix (all from go 1.17.x) and another that runs go vet as linter

The original code uses the golint program that is currently deprecated. If we try to run it, we have the following error:

stmt.go:807:25: exported method NewRow returns unexported type sqlf.newRow, which can be annoying to use

Since I don't know how you want to fix it, I decided to omit the golint action

I would recommend use golangci-lint but if I try to run with the default configuration we got such lint issues:

$ golangci-lint run ./...
cache_test.go:13:17: Error return value of `buf.WriteString` is not checked (errcheck)
	buf.WriteString("test")
	               ^
stmt.go:353:17: Error return value of `buf.WriteString` is not checked (errcheck)
	buf.WriteString("IN (")
	               ^
stmt.go:357:13: Error return value of `buf.Write` is not checked (errcheck)
			buf.Write(placeholderComma)
			         ^
stmt.go:359:13: Error return value of `buf.Write` is not checked (errcheck)
			buf.Write(placeholder)
			         ^
stmt.go:362:17: Error return value of `buf.WriteString` is not checked (errcheck)
	buf.WriteString(")")
	               ^
stmt.go:489:19: Error return value of `q.buf.WriteString` is not checked (errcheck)
	q.buf.WriteString(query.String())
	                 ^
stmt.go:490:19: Error return value of `q.buf.WriteString` is not checked (errcheck)
	q.buf.WriteString(suffix)
	                 ^
stmt.go:525:19: Error return value of `q.buf.WriteString` is not checked (errcheck)
	q.buf.WriteString(query.String())
	                 ^
stmt.go:646:16: Error return value of `stmt.buf.Write` is not checked (errcheck)
	stmt.buf.Write(q.buf.B)
	              ^
stmt.go:682:11: Error return value of `buf.Write` is not checked (errcheck)
	buf.Write(joinOn)
	         ^
stmt.go:684:15: Error return value of `buf.WriteByte` is not checked (errcheck)
	buf.WriteByte(')')
	             ^
executor_test.go:180:13: Error return value of `q.QueryRow` is not checked (errcheck)
		q.QueryRow(ctx, env.db)
		          ^
executor_test.go:191:13: Error return value of `q.QueryRow` is not checked (errcheck)
		q.QueryRow(ctx, env.db)

This linter can be ommited like commant line tool golangci-lint run --disable=errcheck ./..., via a golangci-lint configuration file or via a comment like this //nolint:errcheck // explain the reason... but this should be your choice

Questions

  1. why go.mod requires the old go 1.13? why not go 1.17 like in the tests OR the latest stable (currently 1.22.x)?
  2. why the latest release (v1.4.0) was done years ago? and the latest github release is even older? I would recommend perform a newer release if possible

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.

1 participant