mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Some more style fixes
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
This commit is contained in:
		
							parent
							
								
									6eaac7d571
								
							
						
					
					
						commit
						114838cbda
					
				
					 6 changed files with 23 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -78,7 +78,7 @@ func (t *Table) WriteListTo(dst io.Writer) (n int64, err error) {
 | 
			
		|||
			if _, err := dst.Write([]byte{','}); err != nil {
 | 
			
		||||
				return -1, err
 | 
			
		||||
			}
 | 
			
		||||
			n += 1
 | 
			
		||||
			n++
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if _, err := dst.Write([]byte{']'}); err != nil {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,11 +80,10 @@ func (s *TagStore) pullRepository(r *registry.Session, out io.Writer, localName,
 | 
			
		|||
	if err != nil {
 | 
			
		||||
		if strings.Contains(err.Error(), "HTTP code: 404") {
 | 
			
		||||
			return fmt.Errorf("Error: image %s not found", remoteName)
 | 
			
		||||
		} else {
 | 
			
		||||
		}
 | 
			
		||||
		// Unexpected HTTP error
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log.Debugf("Retrieving the tag list")
 | 
			
		||||
	tagsList, err := r.GetRemoteTags(repoData.Endpoints, remoteName, repoData.Tokens)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,8 +18,8 @@ import (
 | 
			
		|||
func (s *TagStore) getImageList(localRepo map[string]string, requestedTag string) ([]string, map[string][]string, error) {
 | 
			
		||||
	var (
 | 
			
		||||
		imageList   []string
 | 
			
		||||
		imagesSeen  map[string]bool     = make(map[string]bool)
 | 
			
		||||
		tagsByImage map[string][]string = make(map[string][]string)
 | 
			
		||||
		imagesSeen  = make(map[string]bool)
 | 
			
		||||
		tagsByImage = make(map[string][]string)
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	for tag, id := range localRepo {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -170,12 +170,11 @@ func (s *TagStore) CmdTarLayer(job *engine.Job) engine.Status {
 | 
			
		|||
		}
 | 
			
		||||
		defer fs.Close()
 | 
			
		||||
 | 
			
		||||
		if written, err := io.Copy(job.Stdout, fs); err != nil {
 | 
			
		||||
		written, err := io.Copy(job.Stdout, fs)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return job.Error(err)
 | 
			
		||||
		} else {
 | 
			
		||||
			log.Debugf("rendered layer for %s of [%d] size", image.ID, written)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		log.Debugf("rendered layer for %s of [%d] size", image.ID, written)
 | 
			
		||||
		return engine.StatusOK
 | 
			
		||||
	}
 | 
			
		||||
	return job.Errorf("No such image: %s", name)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -288,42 +288,42 @@ func validateTagName(name string) error {
 | 
			
		|||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *TagStore) poolAdd(kind, key string) (chan struct{}, error) {
 | 
			
		||||
	s.Lock()
 | 
			
		||||
	defer s.Unlock()
 | 
			
		||||
func (store *TagStore) poolAdd(kind, key string) (chan struct{}, error) {
 | 
			
		||||
	store.Lock()
 | 
			
		||||
	defer store.Unlock()
 | 
			
		||||
 | 
			
		||||
	if c, exists := s.pullingPool[key]; exists {
 | 
			
		||||
	if c, exists := store.pullingPool[key]; exists {
 | 
			
		||||
		return c, fmt.Errorf("pull %s is already in progress", key)
 | 
			
		||||
	}
 | 
			
		||||
	if c, exists := s.pushingPool[key]; exists {
 | 
			
		||||
	if c, exists := store.pushingPool[key]; exists {
 | 
			
		||||
		return c, fmt.Errorf("push %s is already in progress", key)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	c := make(chan struct{})
 | 
			
		||||
	switch kind {
 | 
			
		||||
	case "pull":
 | 
			
		||||
		s.pullingPool[key] = c
 | 
			
		||||
		store.pullingPool[key] = c
 | 
			
		||||
	case "push":
 | 
			
		||||
		s.pushingPool[key] = c
 | 
			
		||||
		store.pushingPool[key] = c
 | 
			
		||||
	default:
 | 
			
		||||
		return nil, fmt.Errorf("Unknown pool type")
 | 
			
		||||
	}
 | 
			
		||||
	return c, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *TagStore) poolRemove(kind, key string) error {
 | 
			
		||||
	s.Lock()
 | 
			
		||||
	defer s.Unlock()
 | 
			
		||||
func (store *TagStore) poolRemove(kind, key string) error {
 | 
			
		||||
	store.Lock()
 | 
			
		||||
	defer store.Unlock()
 | 
			
		||||
	switch kind {
 | 
			
		||||
	case "pull":
 | 
			
		||||
		if c, exists := s.pullingPool[key]; exists {
 | 
			
		||||
		if c, exists := store.pullingPool[key]; exists {
 | 
			
		||||
			close(c)
 | 
			
		||||
			delete(s.pullingPool, key)
 | 
			
		||||
			delete(store.pullingPool, key)
 | 
			
		||||
		}
 | 
			
		||||
	case "push":
 | 
			
		||||
		if c, exists := s.pushingPool[key]; exists {
 | 
			
		||||
		if c, exists := store.pushingPool[key]; exists {
 | 
			
		||||
			close(c)
 | 
			
		||||
			delete(s.pushingPool, key)
 | 
			
		||||
			delete(store.pushingPool, key)
 | 
			
		||||
		}
 | 
			
		||||
	default:
 | 
			
		||||
		return fmt.Errorf("Unknown pool type")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -653,9 +653,8 @@ func ValidateContextDirectory(srcPath string, excludes []string) error {
 | 
			
		|||
			if err != nil && os.IsPermission(err) {
 | 
			
		||||
				finalError = fmt.Errorf("no permission to read from '%s'", filePath)
 | 
			
		||||
				return err
 | 
			
		||||
			} else {
 | 
			
		||||
				currentFile.Close()
 | 
			
		||||
			}
 | 
			
		||||
			currentFile.Close()
 | 
			
		||||
		}
 | 
			
		||||
		return nil
 | 
			
		||||
	})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue