forked from TrueCloudLab/distribution
Use errors.New() to output the error message and fix some typos
Signed-off-by: fate-grand-order <chenjg@harmonycloud.cn>
This commit is contained in:
parent
4f87c80073
commit
6a8e2ca84f
4 changed files with 7 additions and 6 deletions
2
blobs.go
2
blobs.go
|
@ -152,7 +152,7 @@ type BlobProvider interface {
|
||||||
|
|
||||||
// BlobServer can serve blobs via http.
|
// BlobServer can serve blobs via http.
|
||||||
type BlobServer interface {
|
type BlobServer interface {
|
||||||
// ServeBlob attempts to serve the blob, identifed by dgst, via http. The
|
// ServeBlob attempts to serve the blob, identified by dgst, via http. The
|
||||||
// service may decide to redirect the client elsewhere or serve the data
|
// service may decide to redirect the client elsewhere or serve the data
|
||||||
// directly.
|
// directly.
|
||||||
//
|
//
|
||||||
|
|
|
@ -32,7 +32,7 @@ func init() {
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
fmt.Fprintf(os.Stderr, "usage: %s [files...]\n", os.Args[0])
|
fmt.Fprintf(os.Stderr, "usage: %s [files...]\n", os.Args[0])
|
||||||
fmt.Fprintf(os.Stderr, `
|
fmt.Fprint(os.Stderr, `
|
||||||
Calculate the digest of one or more input files, emitting the result
|
Calculate the digest of one or more input files, emitting the result
|
||||||
to standard out. If no files are provided, the digest of stdin will
|
to standard out. If no files are provided, the digest of stdin will
|
||||||
be calculated.
|
be calculated.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package configuration
|
package configuration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -132,7 +133,7 @@ type Configuration struct {
|
||||||
|
|
||||||
// HTTP2 configuration options
|
// HTTP2 configuration options
|
||||||
HTTP2 struct {
|
HTTP2 struct {
|
||||||
// Specifies wether the registry should disallow clients attempting
|
// Specifies whether the registry should disallow clients attempting
|
||||||
// to connect via http2. If set to true, only http/1.1 is supported.
|
// to connect via http2. If set to true, only http/1.1 is supported.
|
||||||
Disabled bool `yaml:"disabled,omitempty"`
|
Disabled bool `yaml:"disabled,omitempty"`
|
||||||
} `yaml:"http2,omitempty"`
|
} `yaml:"http2,omitempty"`
|
||||||
|
@ -235,7 +236,7 @@ type LogHook struct {
|
||||||
// Levels set which levels of log message will let hook executed.
|
// Levels set which levels of log message will let hook executed.
|
||||||
Levels []string `yaml:"levels,omitempty"`
|
Levels []string `yaml:"levels,omitempty"`
|
||||||
|
|
||||||
// MailOptions allows user to configurate email parameters.
|
// MailOptions allows user to configure email parameters.
|
||||||
MailOptions MailOptions `yaml:"options,omitempty"`
|
MailOptions MailOptions `yaml:"options,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,7 +628,7 @@ func Parse(rd io.Reader) (*Configuration, error) {
|
||||||
v0_1.Loglevel = Loglevel("info")
|
v0_1.Loglevel = Loglevel("info")
|
||||||
}
|
}
|
||||||
if v0_1.Storage.Type() == "" {
|
if v0_1.Storage.Type() == "" {
|
||||||
return nil, fmt.Errorf("No storage configuration provided")
|
return nil, errors.New("No storage configuration provided")
|
||||||
}
|
}
|
||||||
return (*Configuration)(v0_1), nil
|
return (*Configuration)(v0_1), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ func (err ErrManifestUnknownRevision) Error() string {
|
||||||
type ErrManifestUnverified struct{}
|
type ErrManifestUnverified struct{}
|
||||||
|
|
||||||
func (ErrManifestUnverified) Error() string {
|
func (ErrManifestUnverified) Error() string {
|
||||||
return fmt.Sprintf("unverified manifest")
|
return "unverified manifest"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrManifestVerification provides a type to collect errors encountered
|
// ErrManifestVerification provides a type to collect errors encountered
|
||||||
|
|
Loading…
Reference in a new issue