mirror of
https://github.com/genuinetools/reg.git
synced 2024-05-11 00:58:33 -04:00
fix staticcheck
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
067711f90e
commit
d959057b30
|
@ -85,5 +85,5 @@ func (c *Clair) DeleteLayer(ctx context.Context, name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("Got status code: %d", resp.StatusCode)
|
||||
return fmt.Errorf("got status code: %d", resp.StatusCode)
|
||||
}
|
||||
|
|
2
list.go
2
list.go
|
@ -38,7 +38,7 @@ func (cmd *listCommand) Run(ctx context.Context, args []string) error {
|
|||
repos, err := r.Catalog(ctx, "")
|
||||
if err != nil {
|
||||
if _, ok := err.(*json.SyntaxError); ok {
|
||||
return fmt.Errorf("Domain %s is not a valid registry", r.Domain)
|
||||
return fmt.Errorf("domain %s is not a valid registry", r.Domain)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
4
main.go
4
main.go
|
@ -78,7 +78,7 @@ func main() {
|
|||
// Set the before function.
|
||||
p.Before = func(ctx context.Context) error {
|
||||
// On ^C, or SIGTERM handle exit.
|
||||
signals := make(chan os.Signal, 0)
|
||||
signals := make(chan os.Signal)
|
||||
signal.Notify(signals, os.Interrupt)
|
||||
signal.Notify(signals, syscall.SIGTERM)
|
||||
_, cancel := context.WithCancel(ctx)
|
||||
|
@ -115,7 +115,7 @@ func createRegistryClient(ctx context.Context, domain string) (*registry.Registr
|
|||
|
||||
// Prevent non-ssl unless explicitly forced
|
||||
if !forceNonSSL && strings.HasPrefix(auth.ServerAddress, "http:") {
|
||||
return nil, fmt.Errorf("Attempted to use insecure protocol! Use force-non-ssl option to force")
|
||||
return nil, fmt.Errorf("attempted to use insecure protocol! Use force-non-ssl option to force")
|
||||
}
|
||||
|
||||
// Create the registry client.
|
||||
|
|
|
@ -32,5 +32,5 @@ func (r *Registry) Delete(ctx context.Context, repository string, digest digest.
|
|||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("Got status code: %d", resp.StatusCode)
|
||||
return fmt.Errorf("got status code: %d", resp.StatusCode)
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ func (r *Registry) Digest(ctx context.Context, image Image) (digest.Digest, erro
|
|||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNotFound {
|
||||
return "", fmt.Errorf("Got status code: %d", resp.StatusCode)
|
||||
return "", fmt.Errorf("got status code: %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
return digest.Parse(resp.Header.Get("Docker-Content-Digest"))
|
||||
|
|
|
@ -195,7 +195,7 @@ func (r *Registry) Token(ctx context.Context, url string) (string, error) {
|
|||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return "", fmt.Errorf("Getting token failed with StatusCode != StatusOK but %d", resp.StatusCode)
|
||||
return "", fmt.Errorf("getting token failed with StatusCode != StatusOK but %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
var authToken authToken
|
||||
|
|
|
@ -31,7 +31,7 @@ func GetAuthConfig(username, password, registry string) (types.AuthConfig, error
|
|||
|
||||
dcfg, err := config.Load(config.Dir())
|
||||
if err != nil {
|
||||
return types.AuthConfig{}, fmt.Errorf("Loading config file failed: %v", err)
|
||||
return types.AuthConfig{}, fmt.Errorf("loading config file failed: %v", err)
|
||||
}
|
||||
|
||||
// return error early if there are no auths saved
|
||||
|
@ -49,7 +49,7 @@ func GetAuthConfig(username, password, registry string) (types.AuthConfig, error
|
|||
|
||||
authConfigs, err := dcfg.GetAllCredentials()
|
||||
if err != nil {
|
||||
return types.AuthConfig{}, fmt.Errorf("Getting credentials failed: %v", err)
|
||||
return types.AuthConfig{}, fmt.Errorf("getting credentials failed: %v", err)
|
||||
}
|
||||
|
||||
// if they passed a specific registry, return those creds _if_ they exist
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestGetAuthConfig(t *testing.T) {
|
|||
{
|
||||
name: "invalid config dir",
|
||||
configdir: "testdata/invalid",
|
||||
err: errors.New("Loading config file failed: "),
|
||||
err: errors.New("loading config file failed: "),
|
||||
config: types.AuthConfig{},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ import (
|
|||
func StartRegistry(dcli *client.Client, config, username, password string) (string, string, error) {
|
||||
_, filename, _, ok := runtime.Caller(0)
|
||||
if !ok {
|
||||
return "", "", errors.New("No caller information")
|
||||
return "", "", errors.New("no caller information")
|
||||
}
|
||||
|
||||
image := "registry:2"
|
||||
|
@ -126,7 +126,7 @@ func startClairDB(dcli *client.Client) (string, error) {
|
|||
func StartClair(dcli *client.Client) (string, string, error) {
|
||||
_, filename, _, ok := runtime.Caller(0)
|
||||
if !ok {
|
||||
return "", "", errors.New("No caller information")
|
||||
return "", "", errors.New("no caller information")
|
||||
}
|
||||
|
||||
// start the database container.
|
||||
|
@ -284,7 +284,7 @@ func imageExists(dcli *client.Client, image string) (bool, error) {
|
|||
func waitForConn(addr, cert, key string) error {
|
||||
tlsCert, err := tls.LoadX509KeyPair(cert, key)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not load X509 key pair: %v. Make sure the key is not encrypted", err)
|
||||
return fmt.Errorf("could not load X509 key pair: %v. Make sure the key is not encrypted", err)
|
||||
}
|
||||
|
||||
certPool, err := x509.SystemCertPool()
|
||||
|
|
Loading…
Reference in a new issue