-
Notifications
You must be signed in to change notification settings - Fork 9
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
refactor splitDockerDomain to include more documentation #7
refactor splitDockerDomain to include more documentation #7
Conversation
0cd18be
to
5c379c8
Compare
I have some follow-ups, but some may need discussion, so starting with this one /cc @milosgajdos @Jamstah |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7 +/- ##
==========================================
+ Coverage 82.51% 83.71% +1.20%
==========================================
Files 5 5
Lines 366 393 +27
==========================================
+ Hits 302 329 +27
Misses 54 54
Partials 10 10
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have a question and a random wondering which we can ignore. But otherwise LGTM 🤔
// | ||
// Canonicalize them as "docker.io/library/name[:tag]" | ||
|
||
// FIXME(thaJeztah): account for bare "localhost" or "example.com" names, which SHOULD be considered a domain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the worry in this FIXME
with someone doing a pull on docker pull localhost:foobar
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's not a real worry, other than a correctness fix; currently, docker.io
as name would get converted to docker.io/library/docker.io
(and similarly, localhost
becomes docker.io/library/localhost
)
both would probably not be useful without a fix, and rejected by the registry, so it's not a big concern
// - contains a "." (e.g., "example.com" or "127.0.0.1") | ||
// - contains a ":" (e.g., "example:5000", "::1", or "[::1]:5000") | ||
domain, remoteName = maybeDomain, maybeRemoteName | ||
case strings.ToLower(maybeDomain) != maybeDomain: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ignore this comment. This sent me down the rabbit hole of RFCs for domain names; if the unicode cars are allowed in domain names (I'm not entirely clear on some of the mini-research I've undertaken 🙃) then we could use strings.EqualFolds
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my follow-up would keep the original case, but would compare all domain name cases (localhost and the "index.docker.io" domain with strings.EqualFold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial intent here was to keep the existing behavior (warts and all), but just make the code more readable/explained, as it was a lot of logic condensed into a single line
The splitDockerDomain attempts to determine whether the given name contains a domain, or should be used as a "remote-name". The logic used in doing so is based on (legacy) conventions, which have not always been properly documented. The logic used in this function was also optimized for "brevity", but not easy to ready, due to the combination of multiple boolean conditions combined on a single line, and some "double negatives". More documentation may still be needed, but let's start with documenting the logic used in this function; - Use `strings.Cut()` instead of `strings.IndexRune()`, which allows us to use descriptive variable names, and prevents use of the magic `-1` value. - Split the conditions into a switch, so that each of them can be documented separately. While this makes the code more verbose (and introduces some duplication), it should not impact performance, as only one condition would ever be met (performance may even be better, as the old code combined multiple conditions with `&&`). - Introduce a fast-path for single-element ("familiar") names. These names can be canonicalized early, without doing further handling. While working on the code, I also discovered an existing bug (or omission) where the code would not handle bare _domain names_. Ironically, the TestParseDockerRef test has a test-case name "hostname only", but which does not cover that case. THat test-case was transferred from containerd/cri, and does not describe this scenario (possibly was left as a "further exercise"); containerd/cri@25fdf72 Let keep it as a further exercise, but add a "TODO" to remind us doing so. Signed-off-by: Sebastiaan van Stijn <[email protected]>
5c379c8
to
89ee7ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/cenkalti/backoff/v4](https://togithub.com/cenkalti/backoff) | `v4.2.1` -> `v4.3.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fcenkalti%2fbackoff%2fv4/v4.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fcenkalti%2fbackoff%2fv4/v4.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fcenkalti%2fbackoff%2fv4/v4.2.1/v4.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fcenkalti%2fbackoff%2fv4/v4.2.1/v4.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/charmbracelet/huh/spinner](https://togithub.com/charmbracelet/huh) | `v0.0.0-20240306161957-71f31c155b08` -> `v0.3.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fcharmbracelet%2fhuh%2fspinner/v0.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fcharmbracelet%2fhuh%2fspinner/v0.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fcharmbracelet%2fhuh%2fspinner/v0.0.0-20240306161957-71f31c155b08/v0.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fcharmbracelet%2fhuh%2fspinner/v0.0.0-20240306161957-71f31c155b08/v0.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/distribution/reference](https://togithub.com/distribution/reference) | `v0.5.0` -> `v0.6.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fdistribution%2freference/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fdistribution%2freference/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fdistribution%2freference/v0.5.0/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fdistribution%2freference/v0.5.0/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/expr-lang/expr](https://togithub.com/expr-lang/expr) | `v1.16.2` -> `v1.16.3` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fexpr-lang%2fexpr/v1.16.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fexpr-lang%2fexpr/v1.16.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fexpr-lang%2fexpr/v1.16.2/v1.16.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fexpr-lang%2fexpr/v1.16.2/v1.16.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [github.com/go-sql-driver/mysql](https://togithub.com/go-sql-driver/mysql) | `v1.8.0` -> `v1.8.1` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgo-sql-driver%2fmysql/v1.8.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fgo-sql-driver%2fmysql/v1.8.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fgo-sql-driver%2fmysql/v1.8.0/v1.8.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgo-sql-driver%2fmysql/v1.8.0/v1.8.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>cenkalti/backoff (github.com/cenkalti/backoff/v4)</summary> ### [`v4.3.0`](https://togithub.com/cenkalti/backoff/compare/v4.2.1...v4.3.0) [Compare Source](https://togithub.com/cenkalti/backoff/compare/v4.2.1...v4.3.0) </details> <details> <summary>charmbracelet/huh (github.com/charmbracelet/huh/spinner)</summary> ### [`v0.3.0`](https://togithub.com/charmbracelet/huh/releases/tag/v0.3.0) [Compare Source](https://togithub.com/charmbracelet/huh/compare/v0.2.3...v0.3.0) ### Scrolling, autocomplete, smaller binaries and more! This is a big release with a tonne of new features. - Scrollable Forms - Scrollable Selects and Multi selects - Autocomplete for inputs - 7x smaller binaries - Multi select filtering - Lotsa' bugfixes and quality-of-life improvements To upgrade to `huh` v0.3.0: ```bash go get -u github.com/charmbracelet/huh@latest ``` For details read on! #### Scrollable forms If a form is in a small terminal it will automatically resize to fit the available space and the active group will scroll to stay in view. Form heights can also be set manually with the new [`WithHeight`](https://pkg.go.dev/github.com/charmbracelet/[email protected]#Form.WithHeight) method. <img width="800" src="https://vhs.charm.sh/vhs-1krvQFrEFaf3H1h7jbQomc.gif" alt="Made with VHS"> #### Select and Multi select Scrolling Select and Multi select fields can now be restricted to a certain height, allowing their options to be scrollable. This means you can now pack in tonnes of options. To make a `Select` or `MultiSelect` scrollable simply set the height on the field or form through the `Height` method. ```go s := huh.NewSelect() .Title("What’s for dinner?") .Options(/* ... */) .Height(height) ``` <img width="600" src="https://vhs.charm.sh/vhs-7vcNAV9T20oeMFraAFd0B7.gif" alt="Made with VHS"> #### Autocomplete Now `Input`s can offer suggestions making it easier for users to fill out inputs. These suggestions can be accepted autocomplete-style with a configurable key binding (which defaults to <kbd>ctrl+e</kbd>). Simply provide a `[]string` to `Suggestions` to enable this feature. ```go huh.NewInput(). Title("What's for lunch?"). Prompt("? "). Suggestions([]string{ "Artichoke", // ... "Cashew Apple", "Cashews", "Cat Food", "Coconut Milk", "Cucumber", "Curry Paste", "Currywurst", // ... }) ``` <img width="600" src="https://vhs.charm.sh/vhs-49L7gt948FkJxfTzfa2qmE.gif" alt="Made with VHS"> #### More helpful help Forms will automatically adjust their help text to indicate to the user whether the form will continue or submit on actions. This works with hidden groups. In the below example, the user will be asked to list their allergies if they select "Yes" otherwise, the form will submit. <img width="600" src="https://vhs.charm.sh/vhs-7skg7qpQYCMG2Y5Vl751si.gif" alt="Made with VHS"> #### Way smaller binaries Huh now produces way smaller binaries! Thanks to [#​94](https://togithub.com/charmbracelet/huh/issues/94) Huh now has a 7x smaller compiled footprint. Before, using `[email protected]`: 33M ./burger After, using `[email protected]`: 4.5M ./burger #### Thanks, Vitor! Special thanks to the intrepid [@​vitor-mariano](https://togithub.com/vitor-mariano), one of the earliest `huh` contributors, who came in hot with features, fixes, improvements and good vibes. Thank you, Vitor! #### Changelog ##### New - scrollable multi-select by [@​meowgorithm](https://togithub.com/meowgorithm) in [https://github.com/charmbracelet/huh/pull/71](https://togithub.com/charmbracelet/huh/pull/71) - scrollable select by [@​meowgorithm](https://togithub.com/meowgorithm) in [https://github.com/charmbracelet/huh/pull/76](https://togithub.com/charmbracelet/huh/pull/76) - feat: enable filtering on MultiSelect by [@​vitor-mariano](https://togithub.com/vitor-mariano) in [https://github.com/charmbracelet/huh/pull/81](https://togithub.com/charmbracelet/huh/pull/81) - skippable Fields by [@​maaslalani](https://togithub.com/maaslalani) in [https://github.com/charmbracelet/huh/pull/116](https://togithub.com/charmbracelet/huh/pull/116) - autocomplete suggestions on inputs by [@​maaslalani](https://togithub.com/maaslalani) in [https://github.com/charmbracelet/huh/pull/93](https://togithub.com/charmbracelet/huh/pull/93) - scroll form Inputs by [@​maaslalani](https://togithub.com/maaslalani) in [https://github.com/charmbracelet/huh/pull/95](https://togithub.com/charmbracelet/huh/pull/95) - next / previous dynamic help by [@​maaslalani](https://togithub.com/maaslalani) in [https://github.com/charmbracelet/huh/pull/104](https://togithub.com/charmbracelet/huh/pull/104) - reduce binary size by [@​maaslalani](https://togithub.com/maaslalani) in [https://github.com/charmbracelet/huh/pull/94](https://togithub.com/charmbracelet/huh/pull/94) ##### Fixed - fix Select and MultiSelect height when unfocused by [@​vitor-mariano](https://togithub.com/vitor-mariano) in [https://github.com/charmbracelet/huh/pull/80](https://togithub.com/charmbracelet/huh/pull/80) - use CharLimit in textinput by [@​maaslalani](https://togithub.com/maaslalani) in [https://github.com/charmbracelet/huh/pull/79](https://togithub.com/charmbracelet/huh/pull/79) - select viewport on filtering by [@​vitor-mariano](https://togithub.com/vitor-mariano) in [https://github.com/charmbracelet/huh/pull/84](https://togithub.com/charmbracelet/huh/pull/84) - set default theme on inputs by [@​maaslalani](https://togithub.com/maaslalani) in [https://github.com/charmbracelet/huh/pull/92](https://togithub.com/charmbracelet/huh/pull/92) - multiselect: set height in WithHeight by [@​ardnew](https://togithub.com/ardnew) in [https://github.com/charmbracelet/huh/pull/118](https://togithub.com/charmbracelet/huh/pull/118) - shift+tab would fail if first group is hidden by [@​caarlos0](https://togithub.com/caarlos0) in [https://github.com/charmbracelet/huh/pull/103](https://togithub.com/charmbracelet/huh/pull/103) - prevField should not select skippable fields by [@​maaslalani](https://togithub.com/maaslalani) in [https://github.com/charmbracelet/huh/pull/121](https://togithub.com/charmbracelet/huh/pull/121) **Full Changelog**: charmbracelet/huh@v0.2.3...v0.3.0 *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@​charm), or on [Discord](https://charm.sh/chat). ### [`v0.2.3`](https://togithub.com/charmbracelet/huh/releases/tag/v0.2.3) [Compare Source](https://togithub.com/charmbracelet/huh/compare/v0.2.2...v0.2.3) #### Better Defaults! Huh? `v0.2.3` fixes some bugs for more consistent behaviour across inputs 🐞 - `Text` inputs now update values on each keystroke rather than on `Blur` for consistency. - `Select` and `MultiSelect` read their default values from the initial values set by the `Value` variable if provided. A *special* thanks to [@​vitor-mariano](https://togithub.com/vitor-mariano) for all his contributions to this release 🤗 ##### Defaults Example You can now have preselected options by declaring them in the `Value` variable: ```go var toppings = []string{"Lettuce", "Tomatoes"} var options = huh.NewOptions("Lettuce", "Tomatoes", "Charm Sauce", "Cheese", "Vegan Cheese") huh.NewMultiSelect[string]().Title("Toppings").Options(options...).Value(&toppings).Run() ``` In the above example, `Lettuce` and `Tomatoes` will be preselected by default. #### What's Changed - `Text` value updates by [@​vitor-mariano](https://togithub.com/vitor-mariano) in [https://github.com/charmbracelet/huh/pull/64](https://togithub.com/charmbracelet/huh/pull/64) - Prefill `Select` and `MultiSelect` inputs with default values by [@​vitor-mariano](https://togithub.com/vitor-mariano) in [https://github.com/charmbracelet/huh/pull/62](https://togithub.com/charmbracelet/huh/pull/62) **Full Changelog**: charmbracelet/huh@v0.2.2...v0.2.3 *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@​charm), or on [Discord](https://charm.sh/chat). ### [`v0.2.2`](https://togithub.com/charmbracelet/huh/releases/tag/v0.2.2) [Compare Source](https://togithub.com/charmbracelet/huh/compare/v0.2.1...v0.2.2) #### Better Wrapping 🎁 `Huh?` v0.2.2 improves wrapping of the `Input` and `Text` fields. It applies width set on the form to the inputs to perform wrapping based on the specified or terminal width. - Fixed in [https://github.com/charmbracelet/huh/pull/60](https://togithub.com/charmbracelet/huh/pull/60) #### New Contributors - [@​ddddddO](https://togithub.com/ddddddO) made their first contribution in [https://github.com/charmbracelet/huh/pull/56](https://togithub.com/charmbracelet/huh/pull/56) - [@​vitor-mariano](https://togithub.com/vitor-mariano) made their first contribution in [https://github.com/charmbracelet/huh/pull/57](https://togithub.com/charmbracelet/huh/pull/57) **Full Changelog**: charmbracelet/huh@v0.2.1...v0.2.2 *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.social/@​charmcli), or [Discord](https://charm.sh/chat). ### [`v0.2.1`](https://togithub.com/charmbracelet/huh/releases/tag/v0.2.1) [Compare Source](https://togithub.com/charmbracelet/huh/compare/v0.2.0...v0.2.1) ### New Theme! 😸 `huh?` forms can now use Catppuccin themes. (Thanks to the wonderful [@​sgoudham](https://togithub.com/sgoudham) ✨) Simply add the following to your `huh.Form`s: ```go .WithTheme(huh.ThemeCatppuccin()) ``` <img width="500" src="https://github.com/charmbracelet/huh/assets/42545625/fdea4eb5-fa3b-472c-8aa4-9537e9577ab5" /> *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.social/@​charmcli), or [Discord](https://charm.sh/chat). ### [`v0.2.0`](https://togithub.com/charmbracelet/huh/releases/tag/v0.2.0) [Compare Source](https://togithub.com/charmbracelet/huh/compare/v0.1.0...v0.2.0) ### Better Help Styles! `Help` Styles now apply on a `Theme` rather than embedded in `FieldStyles`. (Thanks to the wonderful [@​jolheiser](https://togithub.com/jolheiser) ✨) ```go // Old... theme.Focused.Help.ShortKey = lipgloss.NewStyle() //... // Updated! theme.Help.ShortKey = lipgloss.NewStyle() //... ``` *** <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.social/@​charmcli), or [Discord](https://charm.sh/chat). </details> <details> <summary>distribution/reference (github.com/distribution/reference)</summary> ### [`v0.6.0`](https://togithub.com/distribution/reference/releases/tag/v0.6.0) [Compare Source](https://togithub.com/distribution/reference/compare/v0.5.0...v0.6.0) #### What's Changed - remove deprecated SplitHostname by [@​thaJeztah](https://togithub.com/thaJeztah) in [https://github.com/distribution/reference/pull/5](https://togithub.com/distribution/reference/pull/5) - refactor splitDockerDomain to include more documentation by [@​thaJeztah](https://togithub.com/thaJeztah) in [https://github.com/distribution/reference/pull/7](https://togithub.com/distribution/reference/pull/7) - fix typo in readme by [@​xrstf](https://togithub.com/xrstf) in [https://github.com/distribution/reference/pull/10](https://togithub.com/distribution/reference/pull/10) - Exclude domain from name length check by [@​ozairasim](https://togithub.com/ozairasim) in [https://github.com/distribution/reference/pull/9](https://togithub.com/distribution/reference/pull/9) #### New Contributors - [@​xrstf](https://togithub.com/xrstf) made their first contribution in [https://github.com/distribution/reference/pull/10](https://togithub.com/distribution/reference/pull/10) - [@​ozairasim](https://togithub.com/ozairasim) made their first contribution in [https://github.com/distribution/reference/pull/9](https://togithub.com/distribution/reference/pull/9) **Full Changelog**: distribution/reference@v0.5.0...v0.6.0 </details> <details> <summary>expr-lang/expr (github.com/expr-lang/expr)</summary> ### [`v1.16.3`](https://togithub.com/expr-lang/expr/releases/tag/v1.16.3) [Compare Source](https://togithub.com/expr-lang/expr/compare/v1.16.2...v1.16.3) **Expr** is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy, safety, and speed. ```go program, err := expr.Compile(`let x = 2 + 2; x ^ x`) output, err := expr.Run(program, env) ``` **In this release**: - Improved printing for maps: `{(foo + bar): 42}` **Expr Editor** The [Expr Editor](https://expr-lang.org/editor) is an embeddable code editor written in JavaScript with full support of Expr language. **Expr Pro** [Expr Pro](https://expr-lang.org/expr-pro) is a set of extensions for Expr for advanced use cases. It includes expressions explanation, performance profiling, and more. </details> <details> <summary>go-sql-driver/mysql (github.com/go-sql-driver/mysql)</summary> ### [`v1.8.1`](https://togithub.com/go-sql-driver/mysql/releases/tag/v1.8.1) [Compare Source](https://togithub.com/go-sql-driver/mysql/compare/v1.8.0...v1.8.1) #### What's Changed Bugfixes: - fix race condition when context is canceled in [#​1562](https://togithub.com/go-sql-driver/mysql/pull/1562) and [#​1570](https://togithub.com/go-sql-driver/mysql/pull/1570) **Full Changelog**: go-sql-driver/mysql@v1.8.0...v1.8.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am" (UTC), Automerge - "before 4am" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/woodpecker-ci/woodpecker). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: qwerty287 <[email protected]>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/distribution/reference](https://togithub.com/distribution/reference) | `v0.5.0` -> `v0.6.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fdistribution%2freference/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fdistribution%2freference/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fdistribution%2freference/v0.5.0/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fdistribution%2freference/v0.5.0/v0.6.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>distribution/reference (github.com/distribution/reference)</summary> ### [`v0.6.0`](https://togithub.com/distribution/reference/releases/tag/v0.6.0) [Compare Source](https://togithub.com/distribution/reference/compare/v0.5.0...v0.6.0) #### What's Changed - remove deprecated SplitHostname by [@​thaJeztah](https://togithub.com/thaJeztah) in [https://github.com/distribution/reference/pull/5](https://togithub.com/distribution/reference/pull/5) - refactor splitDockerDomain to include more documentation by [@​thaJeztah](https://togithub.com/thaJeztah) in [https://github.com/distribution/reference/pull/7](https://togithub.com/distribution/reference/pull/7) - fix typo in readme by [@​xrstf](https://togithub.com/xrstf) in [https://github.com/distribution/reference/pull/10](https://togithub.com/distribution/reference/pull/10) - Exclude domain from name length check by [@​ozairasim](https://togithub.com/ozairasim) in [https://github.com/distribution/reference/pull/9](https://togithub.com/distribution/reference/pull/9) #### New Contributors - [@​xrstf](https://togithub.com/xrstf) made their first contribution in [https://github.com/distribution/reference/pull/10](https://togithub.com/distribution/reference/pull/10) - [@​ozairasim](https://togithub.com/ozairasim) made their first contribution in [https://github.com/distribution/reference/pull/9](https://togithub.com/distribution/reference/pull/9) **Full Changelog**: distribution/reference@v0.5.0...v0.6.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xOC4xNyIsInVwZGF0ZWRJblZlciI6IjM4LjE4LjE3IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZWJvdCJdfQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <[email protected]> Co-authored-by: Tyler Helmuth <[email protected]>
We're pulling in an update to kubernetes that includes this change (in https://github.com/kubernetes/kubernetes/pull/126799/files#r1750753594) Is this a refactor without a behavior change? |
@liggitt sorry for the delay 🙈 It's been a while since I worked on this, but I think it was all without change, but I don't think this one made a change in behavior;
I see I have some follow-up changes stashed that I never opened a PR for around matching domain-names not being case-insensitive; #7 (comment) The only one that can be problematic in some cases is; That removes a function that was deprecated, and should no longer be used, but there was one oversight on my hand that the current non-beta release of distribution provides an alias for the deprecated reference functions, and one of those uses that function; https://github.com/distribution/distribution/blob/v2.8.3/reference/reference_deprecated.go#L115-L123 So in code-bases that import the |
Yeah, that's not my concern in https://github.com/kubernetes/kubernetes/pull/126799/files#r1750753594, I was only trying to figure out if code that still compiled would behave differently due to the refactor of splitDockerDomain. Sounds like no :) |
The splitDockerDomain attempts to determine whether the given name contains a domain, or should be used as a "remote-name". The logic used in doing so is based on (legacy) conventions, which have not always been properly documented.
The logic used in this function was also optimized for "brevity", but not easy to ready, due to the combination of multiple boolean conditions combined on a single line, and some "double negatives".
More documentation may still be needed, but let's start with documenting the logic used in this function;
strings.Cut()
instead ofstrings.IndexRune()
, which allows us to use descriptive variable names, and prevents use of the magic-1
value.&&
).While working on the code, I also discovered an existing bug (or omission) where the code would not handle bare domain names. Ironically, the TestParseDockerRef test has a test-case name "hostname only", but which does not cover that case. THat test-case was transferred from containerd/cri, and does not describe this scenario (possibly was left as a "further exercise"); containerd/cri@25fdf72
Let keep it as a further exercise, but add a "TODO" to remind us doing so.