forked from lunny/changelog
0692cd4388
Formatting Signed-off-by: jolheiser <john.olheiser@gmail.com> Skip regex if not set and add newline after error Signed-off-by: jolheiser <john.olheiser@gmail.com> Change skip label to regex Signed-off-by: jolheiser <john.olheiser@gmail.com> Wording Signed-off-by: jolheiser <john.olheiser@gmail.com> Re-generate Signed-off-by: jolheiser <john.olheiser@gmail.com> Wipe out go.sum and tidy Signed-off-by: jolheiser <john.olheiser@gmail.com> Fix potential bug Signed-off-by: jolheiser <john.olheiser@gmail.com> Formatting Signed-off-by: jolheiser <john.olheiser@gmail.com> Formatting Signed-off-by: jolheiser <john.olheiser@gmail.com> Add fresh paint Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: jolheiser <john.olheiser@gmail.com> Reviewed-by: Guillermo Prandi <guillep2k@noreply.gitea.io> Reviewed-by: lafriks <lafriks@noreply.gitea.io>
36 lines
635 B
Go
36 lines
635 B
Go
// +build ignore
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
)
|
|
|
|
const (
|
|
exampleFile = "changelog.example.yml"
|
|
writeFile = "config_default.go"
|
|
tmpl = `package main
|
|
|
|
func init() {
|
|
defaultConfig = []byte(` + "`" + `%s` + "`" + `)
|
|
}
|
|
`
|
|
)
|
|
|
|
func main() {
|
|
bytes, err := ioutil.ReadFile(exampleFile)
|
|
if err != nil {
|
|
fmt.Printf("Could not read from %s. Are you in the root directory of the project?", exampleFile)
|
|
os.Exit(1)
|
|
}
|
|
|
|
data := fmt.Sprintf(tmpl, string(bytes))
|
|
|
|
if err := ioutil.WriteFile(writeFile, []byte(data), os.ModePerm); err != nil {
|
|
fmt.Printf("Could not write to %s.", writeFile)
|
|
os.Exit(1)
|
|
}
|
|
}
|