Merge pull request #707 from jamiehannaford/create-new
Create README file for new SIGs
This commit is contained in:
commit
0d95ccef31
|
|
@ -92,9 +92,13 @@ func (slice SigEntries) Swap(i, j int) {
|
||||||
slice.Sigs[i], slice.Sigs[j] = slice.Sigs[j], slice.Sigs[i]
|
slice.Sigs[i], slice.Sigs[j] = slice.Sigs[j], slice.Sigs[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
func createDirIfNotExists(path string) error {
|
func pathExists(path string) bool {
|
||||||
_, err := os.Stat(path)
|
_, err := os.Stat(path)
|
||||||
if os.IsNotExist(err) {
|
return os.IsExist(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func createDirIfNotExists(path string) error {
|
||||||
|
if !pathExists(path) {
|
||||||
fmt.Printf("%s directory does not exist, creating\n", path)
|
fmt.Printf("%s directory does not exist, creating\n", path)
|
||||||
return os.Mkdir(path, 0755)
|
return os.Mkdir(path, 0755)
|
||||||
}
|
}
|
||||||
|
|
@ -134,6 +138,14 @@ func writeTemplate(templatePath, outputPath string, data interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create if not exists
|
||||||
|
if !pathExists(outputPath) {
|
||||||
|
_, err := os.Create(outputPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// open file and truncate
|
// open file and truncate
|
||||||
f, err := os.OpenFile(outputPath, os.O_RDWR, 0644)
|
f, err := os.OpenFile(outputPath, os.O_RDWR, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue