all: Remove unused code

Using x/tools/cmd/deadcode
This commit is contained in:
Bjørn Erik Pedersen
2023-12-18 17:41:15 +01:00
parent 6f13430d4a
commit 8adba648cc
30 changed files with 32 additions and 405 deletions

View File

@@ -424,16 +424,6 @@ func (i *imageResource) doWithImageConfig(conf images.ImageConfig, f func(src im
return img, nil
}
func (i *imageResource) decodeImageConfig(action, spec string) (images.ImageConfig, error) {
options := strings.Fields(spec)
conf, err := images.DecodeImageConfig(action, options, i.Proc.Cfg, i.Format)
if err != nil {
return conf, err
}
return conf, nil
}
type giphy struct {
image.Image
gif *gif.GIF

View File

@@ -66,7 +66,6 @@ type ResourceError interface {
// ErrProvider provides an Err.
type ErrProvider interface {
// Err returns an error if this resource is in an error state.
// This will currently only be set for resources obtained from resources.GetRemote.
Err() ResourceError
@@ -215,15 +214,3 @@ func (r resourceTypesHolder) ResourceType() string {
func NewResourceTypesProvider(mediaType media.Type, resourceType string) ResourceTypesProvider {
return resourceTypesHolder{mediaType: mediaType, resourceType: resourceType}
}
type languageHolder struct {
lang *langs.Language
}
func (l languageHolder) Language() *langs.Language {
return l.lang
}
func NewLanguageProvider(lang *langs.Language) LanguageProvider {
return languageHolder{lang: lang}
}

View File

@@ -65,7 +65,6 @@ func responseToData(res *http.Response, readBody bool) map[string]any {
}
return m
}
func toHTTPError(err error, res *http.Response, readBody bool) *HTTPError {
@@ -141,7 +140,6 @@ func (c *Client) FromRemote(uri string, optionsm map[string]any) (resource.Resou
if res.StatusCode != http.StatusNotFound {
if res.StatusCode < 200 || res.StatusCode > 299 {
return nil, temporaryHTTPStatusCodes[res.StatusCode], toHTTPError(fmt.Errorf("failed to fetch remote resource: %s", http.StatusText(res.StatusCode)), res, !isHeadMethod)
}
}
@@ -151,9 +149,7 @@ func (c *Client) FromRemote(uri string, optionsm map[string]any) (resource.Resou
}
return b, false, nil
}()
if err != nil {
if retry {
if start.IsZero() {
@@ -174,7 +170,6 @@ func (c *Client) FromRemote(uri string, optionsm map[string]any) (resource.Resou
return hugio.ToReadCloser(bytes.NewReader(b)), nil
}
})
if err != nil {
return nil, err
@@ -307,22 +302,6 @@ func addUserProvidedHeaders(headers map[string]any, req *http.Request) {
}
}
func hasHeaderValue(m http.Header, key, value string) bool {
var s []string
var ok bool
if s, ok = m[key]; !ok {
return false
}
for _, v := range s {
if v == value {
return true
}
}
return false
}
func hasHeaderKey(m http.Header, key string) bool {
_, ok := m[key]
return ok