Skip to content

Proposal: allow ref key for goget types #24

@tummychow

Description

@tummychow

Consider this case:

You depend on package X and you have fixed it at version A. Package X depends on package Y, and you don't care about the version of Y.

You have a deps that looks like this:

---
path: github.com/foo/bar
deps:
  - path: X
    loc: X
    type: git
    ref: A
  - path: Y
    type: goget

Now you bump X to version B. As a side effect of this version bump, X introduces a new dependency on Z. You don't care about the version of Z either. However, the version bump broke your build because you didn't have Z in your .go.yaml.

Okay, let's imagine that my version of goat gen (described on #19) was implemented already. You see that there's a missing dependency in your build, so you immediately know your dep graph is incomplete. You run goat gen again and it fills in Z for you. Now you can carry on with your build.


Counterpoint: what if you could set the ref on a goget package instead? What this means is "whatever deps this thing has, just get them, but I want the thing itself to be at this version". You end up with this deps instead:

---
path: github.com/foo/bar
deps:
  - path: X
    type: goget
    ref: A

Shorter than the original, and no risk of breakage from a new sub-dependency. I don't know who would really care about the difference between the first option and this second hypothetical one, but I know that the second one is clearly more intuitive than the first and requires less thinking. People who are suspicious of introducing any new subtrees in their depgraph without realizing it can always fall back to the first option to enforce their pedantic-ness.

@mediocregopher what are your thoughts? I'd be willing to take a shot at implementing this. It's something that many other dep managers already implement in some form (ie instead of clone, use go get + checkout). We could always borrow some of their code for this purpose ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions