Skip to content

Conversation

@jozsefsallai
Copy link
Contributor

@jozsefsallai jozsefsallai commented May 30, 2022

Added support for retrieving the Go version number from go.mod (if exists). Also added an example and tests for the version parsing method, the docker run output, and plan generation.

Note: I've also updated examples/go-mod, as it was pointing to a Go version that's not available on nix unstable.

Closes #148


match matched_version {
Some((_, pkg)) => Ok(Some(pkg.to_string())),
None => bail!("Go version {} is not available", version),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if the version isn't specified we should default to the go package. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, this should be how we handle it for all providers. If the version isn't found, default to the version on the nixos tag (like the node provider).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The node provider will actually error out if you specify a version in engines that's not in the list of supported versions (I tested the behavior myself). I wanted to preserve the same behavior as on node. But I can change this later.

Copy link

Choose a reason for hiding this comment

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

There's a difference between specifying unsupported version and not specifying any version. Node provider falls back to default version if version isn't specified.

Copy link
Contributor

@coffee-cup coffee-cup left a comment

Choose a reason for hiding this comment

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

Looks good (besides falling back to default go version if none found)! Thanks for adding this.

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.

Golang Version Provider

4 participants