Skip to content

Conversation

@jmooring
Copy link
Member

@jmooring jmooring commented Sep 29, 2025

  1. Validate combination of module path and version
  2. Capture and display error messages from JSON sent to stdout
  3. Remove invalid semver from mod_vendor__versions.txt testscript (Need to investigate: module.Check reports that <=v6.7.42 is "not a semantic version". That is true, but it is a valid semantic version comparison per the Go docs.)

Closes #14010

1. Validate combination of module path and version
2. Capture and display error messages from JSON sent to stdout
3. Remove invalid semver from mod_vendor__versions.txt testscript

Closes gohugoio#14010
@jmooring jmooring force-pushed the improve-module-path-version-error-14010 branch from 10a9426 to 4460b0f Compare September 29, 2025 15:51
@jmooring jmooring marked this pull request as draft September 29, 2025 16:12

// Validate the combination of module path and version.
if moduleImport.Version != "" {
err := module.Check(moduleImport.Path, moduleImport.Version)
Copy link
Member

Choose a reason for hiding this comment

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

I understand this i a draft, and I'm not totally sure what the above check does, but for version when path points to a non-Go-module, a path that does not end with /v2 may point at a v2.0.0 version. I tested this earlier today with:

https://github.com/bep/hugomodnogomod

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, still looking into this. The intent is to prevent invalid semvers and invalid path/semver pairs such as:

path = "github.com/user/project/v3"
version = 'v42.6.7'

path points to a non-Go-module

Thanks. I will probably use https://github.com/bep/hugomodnogomod in an integration test unless this is a temporary repo.

Copy link
Member

Choose a reason for hiding this comment

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

unless this is a temporary repo.

I will let it live, I will probably have a use for it myself some day.

Copy link
Member Author

@jmooring jmooring Sep 29, 2025

Choose a reason for hiding this comment

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

Note to self: there isn't a simple and reliable way to verify that the combination of a module path and version query is semantically correct before attempting to get, list, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants