google / google/go-containerregistry
ggcr: Parsing image name with both tag and digest loses tag info
- Dominant language
- Go
- Stars
- 4k
- Forks
- 686
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 26
Description
### Describe the bug
When parsing image in `repo.com/image:tag@sha256:f8ecdcd87d7d84b87e645074084dd7f57dd62c76e120bb21e5abde158755be56`format it gets parsed as a Digest type, which returns digest from the `ref.Identifier()` function, and doesn't provide easy access to the tag information
I'm only using the name parsing, so I have no idea if this would have any negative impact on any other part of the library
### To Reproduce
```go
ref, _ := name.ParseReference(repo.com/image:tag@sha256:f8ecdcd87d7d84b87e645074084dd7f57dd62c76e120bb21e5abde158755be56")
fmt.Println(ref.Identifier()) // sha256:f8ecdcd87d7d84b87e645074084dd7f57dd62c76e120bb21e5abde158755be56
// fmt.Println(ref.Tag()) - doesn't exist
```
### Expected behavior
I'd expect to have a `ref.Tag()` function in the `Reference` interface that can return image tag for both `Tag` and `Digest` structs, so that the tag name is always accessible
### Additional context
- go-containerregistry v0.20.3
Contributor guide
Research direction
Start at name.ParseReference and the Reference interface, then inspect the Tag and Digest implementations described in the issue. Trace how a reference containing both a tag and digest is represented and run the existing reference-parsing tests. Done means the tag remains accessible for both reference forms without changing the digest returned by Identifier().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100