aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/net.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-12 03:53:19 +0900
committerOphestra <cat@gensokyo.uk>2026-01-12 03:53:19 +0900
commit91c3594dee2f1689501997d395af7019df8bebe2 (patch)
treec8f88efdb9d791179f9682e6ea8d2da987548d42 /internal/pkg/net.go
parent7ccc2fc5ece9c6236c02585ef4048fdc2b4a5b51 (diff)
internal/pkg: append user-facing name in messages
This makes verbose messages much more useful. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/net.go')
-rw-r--r--internal/pkg/net.go6
1 files changed, 6 insertions, 0 deletions
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