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

Make schemagen generate compilable code and add test for it #278

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

dkropachev
Copy link
Contributor

@dkropachev dkropachev commented Jun 26, 2024

It turns out that schemagen does not generate compilable file after switching from v1 to v2
Make it compilable and have a test for it

@@ -30,7 +30,7 @@ func TestSchemagen(t *testing.T) {

b := runSchemagen(t, "foobar")

const goldenFile = "testdata/models.go.txt"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason for a file name change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has changed since I want to test generated code for real

Comment on lines 123 to 124
if c.Type == "duration" && !existsInSlice(imports, "github.com/gocql/gocql") {
imports = append(imports, "github.com/gocql/gocql")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why adding v2 to gocql? I thought we add v2 to gocqlx not gocql.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks.

@dkropachev dkropachev force-pushed the dk/fix-schemagen-test branch 5 times, most recently from 4cbd1cd to 5396809 Compare June 27, 2024 16:26
.gitignore Outdated Show resolved Hide resolved
cmd/schemagen/testdata/models_test.go Outdated Show resolved Hide resolved
cmd/schemagen/schemagen.go Show resolved Hide resolved
@dkropachev dkropachev changed the title Make schemagen compilable and add test for it Make schemagen generate compilable code and add test for it Jun 28, 2024
@sylwiaszunejko sylwiaszunejko merged commit 653faf1 into scylladb:master Jun 28, 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.

None yet

2 participants