internal/pkg: append user-facing name in messages
All checks were successful
Test / Create distribution (push) Successful in 46s
Test / Sandbox (push) Successful in 2m58s
Test / ShareFS (push) Successful in 4m49s
Test / Sandbox (race detector) (push) Successful in 5m25s
Test / Hpkg (push) Successful in 5m31s
Test / Hakurei (push) Successful in 5m46s
Test / Hakurei (race detector) (push) Successful in 7m46s
Test / Flake checks (push) Successful in 1m47s

This makes verbose messages much more useful.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-01-12 03:53:19 +09:00
parent 7ccc2fc5ec
commit 91c3594dee
3 changed files with 45 additions and 2 deletions

View File

@@ -3,8 +3,10 @@ package pkg
import (
"context"
"crypto/sha512"
"fmt"
"io"
"net/http"
"path"
"sync"
)
@@ -30,6 +32,7 @@ type httpArtifact struct {
}
var _ KnownChecksum = new(httpArtifact)
var _ fmt.Stringer = new(httpArtifact)
// NewHTTPGet returns a new [File] backed by the supplied client. A GET request
// is set up for url. If c is nil, [http.DefaultClient] is used instead.
@@ -57,6 +60,9 @@ func (a *httpArtifact) Dependencies() []Artifact { return nil }
// Checksum returns the caller-supplied checksum.
func (a *httpArtifact) Checksum() Checksum { return a.checksum }
// String returns [path.Base] over the backing url.
func (a *httpArtifact) String() string { return path.Base(a.url) }
// ResponseStatusError is returned for a response returned by an [http.Client]
// with a status code other than [http.StatusOK].
type ResponseStatusError int