aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/config/config.go3
-rw-r--r--pkg/mgrconfig/testdata/gce1.cfg2
2 files changed, 5 insertions, 0 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go
index a4f56c225..9ff25ecd7 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -8,6 +8,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
+ "regexp"
"github.com/google/syzkaller/pkg/osutil"
)
@@ -24,6 +25,8 @@ func LoadFile(filename string, cfg interface{}) error {
}
func LoadData(data []byte, cfg interface{}) error {
+ // Remove comment lines starting with #.
+ data = regexp.MustCompile(`(^|\n)\s*#.*?\n`).ReplaceAll(data, nil)
dec := json.NewDecoder(bytes.NewReader(data))
dec.DisallowUnknownFields()
if err := dec.Decode(cfg); err != nil {
diff --git a/pkg/mgrconfig/testdata/gce1.cfg b/pkg/mgrconfig/testdata/gce1.cfg
index 44b4eae12..805a1f418 100644
--- a/pkg/mgrconfig/testdata/gce1.cfg
+++ b/pkg/mgrconfig/testdata/gce1.cfg
@@ -1,4 +1,6 @@
+# This is a test comment in the config.
{
+ # This is a test comment in the config.
"name": "windows-gce",
"target": "windows/amd64",
"http": ":10000",