{"id":16038038,"url":"https://github.com/joseluisq/semver-aliases","last_synced_at":"2025-04-05T05:41:44.232Z","repository":{"id":146283928,"uuid":"294062738","full_name":"joseluisq/semver-aliases","owner":"joseluisq","description":"A simple Go package to create deduplicated version aliases based on valid SemVer release names.","archived":false,"fork":false,"pushed_at":"2023-06-20T21:58:43.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-13T23:18:58.137Z","etag":null,"topics":["golang","golang-package","semver","semver-aliases","semver-parser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joseluisq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-09-09T09:15:31.000Z","updated_at":"2023-06-20T21:57:02.000Z","dependencies_parsed_at":"2023-10-12T07:30:38.734Z","dependency_job_id":null,"html_url":"https://github.com/joseluisq/semver-aliases","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"edf4cf5eea52ab6ad4fff9cc05b8610364bc0a1b"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fsemver-aliases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fsemver-aliases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fsemver-aliases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joseluisq%2Fsemver-aliases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joseluisq","download_url":"https://codeload.github.com/joseluisq/semver-aliases/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107828,"owners_count":20884797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","golang-package","semver","semver-aliases","semver-parser"],"created_at":"2024-10-08T22:23:09.109Z","updated_at":"2025-04-05T05:41:44.207Z","avatar_url":"https://github.com/joseluisq.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go SemVer Aliases [![devel](https://github.com/joseluisq/semver-aliases/actions/workflows/devel.yml/badge.svg)](https://github.com/joseluisq/semver-aliases/actions/workflows/devel.yml) [![codecov](https://codecov.io/gh/joseluisq/semver-aliases/branch/master/graph/badge.svg)](https://codecov.io/gh/joseluisq/semver-aliases) [![Go Report Card](https://goreportcard.com/badge/github.com/joseluisq/semver-aliases)](https://goreportcard.com/report/github.com/joseluisq/semver-aliases) [![GoDoc](https://godoc.org/github.com/joseluisq/semver-aliases?status.svg)](https://pkg.go.dev/github.com/joseluisq/semver-aliases)\n\n\u003e A simple Go package to create deduplicated version aliases based on valid [SemVer](https://semver.org/) release names.\n\nThe library takes care of optional prefixed releases (`v`) as well as all version names are *deduplicated* and *sorted* in lexicographic order.\n\nFor example this library can be used to create SemVer and custom aliases for [tagging Docker images](https://docs.docker.com/engine/reference/commandline/tag/).\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\taliases \"github.com/joseluisq/semver-aliases\"\n)\n\nfunc main() {\n\t// 1. Create alias names based on a given release\n\tversionAliases := aliases.FromVersion(\"v1.0.0\")\n\tfmt.Printf(\"%#v\\n\", versionAliases)\n\t//\t[]string{\"1\", \"1.0\", \"1.0.0\"}\n\n\textras := []string{\"latest\", \"stable\", \"v1.0.0\", \"1.0\"}\n\tcomposed := append(versionAliases, extras...)\n\tfmt.Printf(\"%#v\\n\", composed)\n\t//\t[]string{\"1\", \"1.0\", \"1.0.0\", \"latest\", \"stable\", \"v1.0.0\", \"1.0\"}\n\n\t// 2. Or create alias names based on a list of names (deduplicated and sorted)\n\ttags := aliases.FromVersionNames(composed)\n\tfmt.Printf(\"%#v\\n\", tags)\n\t//\t[]string{\"1\", \"1.0\", \"1.0.0\", \"latest\", \"stable\"}\n\n\t// 3. Or create version names with its items suffixed (sorted)\n\tsuffixed := aliases.GetVersionNamesSuffixed(versionAliases, \"linux-amd64\")\n\tfmt.Printf(\"%#v\\n\", suffixed)\n\t//\t[]string{\"1-linux-amd64\", \"1.0-linux-amd64\", \"1.0.0-linux-amd64\"}\n}\n```\n\n## Examples\n\n- [examples/aliases.go](./examples/aliases.go)\n- [Playground code example](https://goplay.tools/snippet/g6zkaBTq60D)\n- Tests examples at [aliases_test.go](./aliases_test.go)\n\n## Documentation\n\n[pkg.go.dev/github.com/joseluisq/semver-aliases](https://pkg.go.dev/github.com/joseluisq/semver-aliases)\n\n## Contributions\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.\n\nFeel free to send some [Pull request](https://github.com/joseluisq/semver-aliases/pulls) or [issue](https://github.com/joseluisq/semver-aliases/issues).\n\n## License\n\nThis work is primarily distributed under the terms of both the [MIT license](LICENSE-MIT) and the [Apache License (Version 2.0)](LICENSE-APACHE).\n\n© 2020-present [Jose Quintana](http://git.io/joseluisq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoseluisq%2Fsemver-aliases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoseluisq%2Fsemver-aliases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoseluisq%2Fsemver-aliases/lists"}