@@ -26,10 +26,14 @@ func convertFile(orig string, new string, enableQuic bool, convBootstrap convArr
2626 if err != nil {
2727 return err
2828 }
29+ defer in .Close ()
30+
2931 out , err := os .Create (new )
3032 if err != nil {
3133 return err
3234 }
35+ defer out .Close ()
36+
3337 return convert (in , out , enableQuic , convBootstrap , convSwarm )
3438}
3539
@@ -65,9 +69,12 @@ func convert(in io.Reader, out io.Writer, enableQuic bool, convBootstrap convArr
6569 if err != nil {
6670 return err
6771 }
68- out .Write (fixed )
69- out .Write ([]byte ("\n " ))
70- return nil
72+
73+ if _ , err := out .Write (fixed ); err != nil {
74+ return err
75+ }
76+ _ , err = out .Write ([]byte ("\n " ))
77+ return err
7178}
7279
7380// Remove Experimental.QUIC flag
@@ -77,7 +84,11 @@ func removeExperimentalQuic(confMap map[string]interface{}) (bool, bool) {
7784 return false , false
7885 }
7986 enabledi , ok := confExpi ["QUIC" ]
80- enabled := enabledi .(bool )
87+ if ! ok {
88+ return false , false
89+ }
90+
91+ enabled , ok := enabledi .(bool )
8192
8293 delete (confExpi , "QUIC" )
8394
@@ -88,7 +99,7 @@ func removeExperimentalQuic(confMap map[string]interface{}) (bool, bool) {
8899func convertBootstrap (confMap map [string ]interface {}, conv convArray ) {
89100 bootstrapi , _ := confMap ["Bootstrap" ].([]interface {})
90101 if bootstrapi == nil {
91- log .Log ("Bootstrap field missing or of the wrong type " )
102+ log .Log ("No Bootstrap field in config, skipping " )
92103 return
93104 }
94105 bootstrap := make ([]string , len (bootstrapi ))
0 commit comments