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

chore(project): use go version 1.16 #639

Merged
merged 19 commits into from
Oct 25, 2021
Merged

chore(project): use go version 1.16 #639

merged 19 commits into from
Oct 25, 2021

Conversation

s-takehana
Copy link
Contributor

@s-takehana s-takehana marked this pull request as ready for review October 19, 2021 06:50
@s-takehana s-takehana requested a review from steebchen as a code owner October 19, 2021 06:50
Comment on lines 4 to 7

replace github.com/prisma/prisma-client-go => ../../

require github.com/prisma/prisma-client-go v0.0.0-00010101000000-000000000000
Copy link
Owner

Choose a reason for hiding this comment

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

Keep this. It ensures using the local version instead of the latest remote version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That way just didn't work(Related to golang/go#44529 ?).
Instead, I selected go get + @main :
https://github.com/prisma/prisma-client-go/pull/639/files#diff-4610f5d48e8f2c54a79733a1c01da75dcf5cd5ebd0f5025cd69bda1a5c48002eR12

https://github.com/prisma/prisma-client-go/runs/3935635760#step:3:68

Step 7/17 : RUN go get github.com/prisma/prisma-client-go@main
---> Running in 1b84702995fe
go: downloading github.com/prisma/prisma-client-go v0.11.1-0.20211018171814-8b28b371abd3
go: downloading github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365
go: downloading github.com/takuoki/gocase v1.0.0
go get: added github.com/prisma/prisma-client-go v0.11.1-0.20211018171814-8b28b371abd3

Copy link
Owner

Choose a reason for hiding this comment

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

see the other thread about go mod tidy, I believe that should solve this as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🆗

test/integration/integration.dockerfile Outdated Show resolved Hide resolved

# generate the client in the integration folder
RUN cd test/integration/; go run github.com/prisma/prisma-client-go generate --schema schemax.prisma
RUN go mod tidy
Copy link
Owner

Choose a reason for hiding this comment

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

Why this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Below is without go mod tidy take.
https://github.com/prisma/prisma-client-go/runs/3935412453#step:3:1956

Step 14/21 : RUN cd test/integration/; go build -o /app/main .
---> Running in fd9ddcd9a6af
go: integration/db: package github.com/iancoleman/strcase imported from implicitly required module; to add missing requirements, run:
go get github.com/iancoleman/strcase@v0.0.0-20190422225806-e506e3ef7365
go: integration/db: package github.com/takuoki/gocase imported from implicitly required module; to add missing requirements, run:
go get github.com/takuoki/gocase@v1.0.0
The command '/bin/sh -c cd test/integration/; go build -o /app/main .' returned a non-zero code: 1

Also,
https://golang.org/doc/go1.16#go-command

Build commands like go build and go test no longer modify go.mod and go.sum by default. Instead, they report an error if a module requirement or checksum needs to be added or updated (as if the -mod=readonly flag were used). Module requirements and sums may be adjusted with go mod tidy or go get.

Therefore, we should execute go mod tidy after generating files.

Copy link
Owner

Choose a reason for hiding this comment

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

I think what we should do instead is commit the go.sum file to VCS, and ensure go mod tidy was run after generating files locally, so that both go mod/sum files are up-to-date. Then we would also not need to run go mod tidy at runtime.

Copy link
Owner

Choose a reason for hiding this comment

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

I think I set it up locally, if you want I can push the correct mod/sum file to this branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I'll try tomorrow.

Copy link
Contributor Author

@s-takehana s-takehana Oct 20, 2021

Choose a reason for hiding this comment

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

I think I set it up locally, if you want I can push the correct mod/sum file to this branch.

Please push it. Thank you.

Copy link
Owner

@steebchen steebchen Oct 20, 2021

Choose a reason for hiding this comment

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

Can you please try pulling/rebasing from this repo's branch test-integration-mod, I have pushed the diff there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you!
やったー!_gifmagazine

test/integration/integration.dockerfile Show resolved Hide resolved
@steebchen steebchen changed the title fix: Go version 1.16 chore(project): use go version 1.16 Oct 19, 2021
Comment on lines -7 to +13
require github.com/prisma/prisma-client-go v0.0.0-00010101000000-000000000000
require (
github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365
github.com/joho/godotenv v1.3.0
github.com/prisma/prisma-client-go v0.0.0-00010101000000-000000000000
github.com/shopspring/decimal v1.2.0
github.com/takuoki/gocase v1.0.0
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this I got an error.

https://github.com/prisma/prisma-client-go/runs/3958761686#step:3:1046

Step 9/16 : RUN go build -o /app/main .
---> Running in d65bf1e64845
go: integration/db: package github.com/iancoleman/strcase imported from implicitly required module; to add missing requirements, run:
go get github.com/iancoleman/strcase@v0.0.0-20190422225806-e506e3ef7365
go: integration/db: package github.com/joho/godotenv imported from implicitly required module; to add missing requirements, run:
go get github.com/joho/godotenv@v1.3.0
go: integration/db: package github.com/shopspring/decimal imported from implicitly required module; to add missing requirements, run:
go get github.com/shopspring/decimal@v1.2.0
go: integration/db: package github.com/takuoki/gocase imported from implicitly required module; to add missing requirements, run:
go get github.com/takuoki/gocase@v1.0.0
The command '/bin/sh -c go build -o /app/main .' returned a non-zero code: 1

Copy link
Owner

Choose a reason for hiding this comment

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

yeah this is actually correct 👍

@steebchen steebchen merged commit e877fc9 into steebchen:main Oct 25, 2021
@s-takehana s-takehana deleted the fix_go_version branch October 25, 2021 08:31
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.

2 participants