deleted pkg/repocli/go.mod pkg/repocli/go.sum; some updates

This commit is contained in:
2026-03-02 11:07:41 +02:00
parent 0eab0ad13d
commit 2d34ec5634
5 changed files with 44 additions and 37 deletions
+4 -4
View File
@@ -26,6 +26,7 @@ import (
const (
indexMediaType = "application/vnd.oci.image.index.v1+json"
manifestMediaType = "application/vnd.oci.image.manifest.v1+json"
)
func (cli *Client) ImageManifest(ctx context.Context, imagepath string) (any, error) {
@@ -90,16 +91,15 @@ func (cli *Client) ImageManifest(ctx context.Context, imagepath string) (any, er
return res, err
}
res = index
case manifestMediaType:
//case manifestMediaType:
default:
var manifest ocispec.Manifest
err = json.Unmarshal(manifestBytes, &manifest)
if err != nil {
return res, err
}
res = &manifest
default:
err = fmt.Errorf("Unknown media type: %s", descr.MediaType)
fmt.Printf("Unknown or empty media type: %s", descr.MediaType)
}
return res, err
}
+38
View File
@@ -0,0 +1,38 @@
package repocli
import (
"context"
"fmt"
"net/http"
)
func (cli *Client) DeleteBlob(ctx context.Context, rawrepo, digest string) (bool, error) {
var err error
var exist bool
ref, err := NewRepository(rawrepo)
if err != nil {
return exist, err
}
uri := ref.Blob(digest)
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, uri, nil)
if err != nil {
return exist, err
}
req.Header.Set("User-Agent", cli.userAgent)
req.Header.Set("Accept", "*/*")
resp, err := cli.httpClient.Do(req)
if err != nil {
return exist, err
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusNotFound {
return exist, err
}
if resp.StatusCode != http.StatusOK {
err := fmt.Errorf("Unxected response code %s", resp.Status)
return exist, err
}
exist = true
return exist, err
}
-15
View File
@@ -1,15 +0,0 @@
module client
go 1.25.0
require (
github.com/opencontainers/image-spec v1.1.0
github.com/stretchr/testify v1.11.1
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
-16
View File
@@ -1,16 +0,0 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+2 -2
View File
@@ -81,8 +81,8 @@ func (down *Downloader) Pull(ctx context.Context, rawref, dir, os, arch string)
if err != nil {
return err
}
"oci-layout"
"index.json"
//"oci-layout"
//"index.json"
layers := make([]ocispec.Descriptor, 0)
layers = append(layers, manifest.Config)