Skip to content

Go Modules #394

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 3 commits into from
Mar 12, 2019
Merged

Go Modules #394

merged 3 commits into from
Mar 12, 2019

Conversation

kpurdon
Copy link
Contributor

@kpurdon kpurdon commented Mar 12, 2019

This serves as the most basic support of Go modules possible. Fixes #388.

@kpurdon kpurdon mentioned this pull request Mar 12, 2019
go.mod Outdated
@@ -0,0 +1,3 @@
module github.com/streadway/amqp

go 1.12
Copy link
Owner

Choose a reason for hiding this comment

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

Can you explain why we need this line while we still support go 1.10?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is new in Go 1.12: https://golang.org/doc/go1.12#modules

The go directive in a go.mod file now indicates the version of the language used by the files within that module. It will be set to the current release (go 1.12) if no existing version is present. If the go directive for a module specifies a version newer than the toolchain in use, the go command will attempt to build the packages regardless, and will note the mismatch only if that build fails.

It could probably be removed, It was automatically added during the go mod init I ran.

Copy link
Owner

Choose a reason for hiding this comment

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

I’m pretty sure this library uses version 1.9 (maybe a few features of 1.10) of the language. Does it make sense to change to something lower than 1.12?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, it's a bit unclear to me if this should be an indicator of the current or minimal Go version the module supports.

I think it's probably safe to just remove it for now until it becomes clearer what the point of it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interestingly enough it seems we'll need to keep this value as go mod tidy on Go 1.12+ re-adds it as go 1.12 each time.

I've asked on r/golang what the purpose of this value is and what it should be set too. We'll see what people have to say 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.

https://go-review.googlesource.com/c/go/+/164318/ does seem to indicate this is a minimum Go version supported.

From: golang/go#30446 (comment)

What people say above is correct: when creating a module with Go 1.12, and thereby getting a go 1.12 in your go.mod file, you need to use at least Go 1.11.4 to build the module going forward. Closing because this is working as expected. I agree that this is imperfect but the only other option I see would be to delay all language changes for another six months, which seems severe.

I've swapped the value to be go 1.10 since this is the minimal version being tested in TravisCI. It's still pretty unclear to me what the impact of having a pre go 1.11 version is.

Thoughts?

Copy link
Collaborator

@michaelklishin michaelklishin Mar 12, 2019

Choose a reason for hiding this comment

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

1.11 is over 6 months old. I'd say it's a pretty safe bet.

@streadway streadway merged commit 14f78b4 into streadway:master Mar 12, 2019
@kpurdon
Copy link
Contributor Author

kpurdon commented Mar 12, 2019

Just to follow up post-merge I'm still not confident go 1.10 makes sense in go.mod, but I still don't fully grasp that directive. At least it wont break anything. Putting go 1.12 in will actually break Go 1.11, so that is not workable.

Lots of conversation still happening here: https://www.reddit.com/r/golang/comments/b0b8k3/what_version_should_the_gomod_go_directive_be_set/

@michaelklishin
Copy link
Collaborator

@kpurdon thank you for sticking with it 👍

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.

3 participants