File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,12 +3,14 @@ package main
33import (
44 "bytes"
55 "fmt"
6- yaml "gopkg.in/yaml.v2 "
6+ "io/ioutil "
77 "log"
88 "os"
99 "os/exec"
1010 "regexp"
1111 "strings"
12+
13+ yaml "gopkg.in/yaml.v2"
1214)
1315
1416const guidelinesLink = "Please refer to https://github.com/haproxy/haproxy/blob/master/CONTRIBUTING#L632"
@@ -181,11 +183,22 @@ func readGitEnvironment() (*gitEnv, error) {
181183}
182184
183185func main () {
186+ var config string
187+ if data , err := ioutil .ReadFile (".check-commit.yml" ); err == nil {
188+ config = string (data )
189+ } else {
190+ log .Printf ("no config found, using built-in fallback configuration (HAProxy defaults)" )
191+ config = defaultConf
192+ }
184193
185- if err := yaml .Unmarshal ([]byte (defaultConf ), & myConfig ); err != nil {
194+ if err := yaml .Unmarshal ([]byte (config ), & myConfig ); err != nil {
186195 log .Fatalf ("error reading configuration: %s" , err )
187196 }
188- fmt .Printf ("%s\n " , myConfig )
197+ c1 , _ := yaml .Marshal (myConfig )
198+ c2 , _ := yaml .Marshal (prgConfig {}) // empty config
199+ if string (c1 ) == string (c2 ) {
200+ log .Printf ("WARNING: using empty configuration (i.e. no verification)" )
201+ }
189202
190203 var out []byte
191204
You can’t perform that action at this time.
0 commit comments