File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,12 +94,15 @@ func (c *Config) Validate() error {
9494 return nil
9595}
9696
97- // Default returns the default configuration.
97+ // Default returns a *copy* of the default configuration.
9898func Default () * Config {
99- return & Config {
100- Emulators : DefaultEmulators ,
101- Networks : DefaultNetworks ,
99+ cfg := & Config {
100+ Emulators : make ( Emulators , len ( DefaultEmulators )) ,
101+ Networks : make ( Networks , len ( DefaultNetworks )) ,
102102 }
103+ copy (cfg .Emulators , DefaultEmulators )
104+ copy (cfg .Networks , DefaultNetworks )
105+ return cfg
103106}
104107
105108var ErrOutdatedFormat = errors .New ("you are using old configuration format" )
Original file line number Diff line number Diff line change @@ -75,7 +75,9 @@ func (s *Spinner) run() {
7575 spinnerCharset [i % len (spinnerCharset )],
7676 s .suffix ,
7777 )
78+ mu .Lock ()
7879 _ = writer .Flush ()
80+ mu .Unlock ()
7981 i ++
8082 }
8183 }
You can’t perform that action at this time.
0 commit comments