From 91c3594dee2f1689501997d395af7019df8bebe2 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 12 Jan 2026 03:53:19 +0900 Subject: internal/pkg: append user-facing name in messages This makes verbose messages much more useful. Signed-off-by: Ophestra --- internal/pkg/net.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/pkg/net.go') diff --git a/internal/pkg/net.go b/internal/pkg/net.go index 737dfd85..b8d85b91 100644 --- a/internal/pkg/net.go +++ b/internal/pkg/net.go @@ -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 -- cgit v1.3.1