aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/net.go
diff options
context:
space:
mode:
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