@@ -198,7 +198,6 @@ func (a *Astilectron) listen() (err error) {
198198 // Log
199199 astilog .Debug ("Listening..." )
200200
201- var addr string
202201 listenType := "tcp"
203202 /*
204203 * Switching between Unix-Socket and TCP-Socket
@@ -207,29 +206,25 @@ func (a *Astilectron) listen() (err error) {
207206 */
208207 if len (a .options .Addr ) == 0 {
209208 if runtime .GOOS != "windows" {
210- addr = filepath .Join (a .paths .DataDirectory (), "astilectron.sock" )
209+ a . options . Addr = filepath .Join (a .paths .DataDirectory (), "astilectron.sock" )
211210 /*
212211 * Not checking error for this, as this step
213- * is to avoid any error for net.listen while creation
214- * of unix socket.
212+ * is to avoid any error for net.listen while
213+ * creation of unix socket.
215214 */
216- os .Remove (addr )
215+ os .Remove (a . options . Addr )
217216 listenType = "unix"
218- a .options .Addr = "unix://" + a .options .Addr
219217 } else {
220- addr = "127.0.0.1:0"
221- a .options .Addr = "tcp://" + addr
218+ a .options .Addr = "127.0.0.1:0"
222219 }
223220 } else {
224- addr = a .options .Addr
225221 if runtime .GOOS != "windows" {
226222 listenType = "unix"
227223 }
228- a .options .Addr = listenType + "://" + addr
229224 }
230225
231226 // Listen
232- if a .listener , err = net .Listen (listenType , addr ); err != nil {
227+ if a .listener , err = net .Listen (listenType , a . options . Addr ); err != nil {
233228 return errors .Wrap (err , listenType + " net.Listen failed" )
234229 }
235230
0 commit comments