mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-31 09:26:52 +00:00 
			
		
		
		
	Move the tool as a dependency for static checks migration. Fixes #8187 Signed-off-by: Bin Liu <bin@hyper.sh> Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com> Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com> Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com> Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com> Signed-off-by: Julio Montes <julio.montes@intel.com>
		
			
				
	
	
		
			37 lines
		
	
	
		
			673 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			673 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| //
 | |
| // Copyright (c) 2019 Intel Corporation
 | |
| //
 | |
| // SPDX-License-Identifier: Apache-2.0
 | |
| //
 | |
| 
 | |
| package main
 | |
| 
 | |
| import "fmt"
 | |
| 
 | |
| // newHeading creates a new Heading.
 | |
| func newHeading(name, mdName string, level int) (Heading, error) {
 | |
| 	if name == "" {
 | |
| 		return Heading{}, fmt.Errorf("heading name cannot be blank")
 | |
| 	}
 | |
| 
 | |
| 	if mdName == "" {
 | |
| 		return Heading{}, fmt.Errorf("heading markdown name cannot be blank")
 | |
| 	}
 | |
| 
 | |
| 	linkName, err := createHeadingID(name)
 | |
| 	if err != nil {
 | |
| 		return Heading{}, err
 | |
| 	}
 | |
| 
 | |
| 	if level < 1 {
 | |
| 		return Heading{}, fmt.Errorf("level needs to be atleast 1")
 | |
| 	}
 | |
| 
 | |
| 	return Heading{
 | |
| 		Name:     name,
 | |
| 		MDName:   mdName,
 | |
| 		LinkName: linkName,
 | |
| 		Level:    level,
 | |
| 	}, nil
 | |
| }
 |