This is a creation in Article, where the information may have evolved or changed.
In the previous example we looked at spawning external processes. We do the when we need a external process accessible to running Go process. Sometimes we just want to completely replace the current Go process with another one. To does this we'll use Go ' s implementation of the classic EXEC function
Package Mainimport ("OS" "os/exec" "Syscall"Func Main () {binary, Lookerr:= Exec. Lookpath ("ls") ifLookerr! =Nil {panic (Lookerr)} args:= []string{"ls"," -A","- L","- H"} env:=OS. Environ () Execerr:=Syscall. Exec (binary, args, env)ifExecerr! =Nil {panic (execerr)}}
Total3656drwxr-xr-x -XJK Staff 578B APR1 -: +. DRWXR-xr-x+ -XJK Staff1.0K Mar6 -:xx ..-rw-r--r--@1XJK Staff6.0K Mar - One: + . Ds_store-rw-r--r--1XJK Staff 838B Mar - -: -Reading.go-rw-r--r--1XJK Staff 553B Mar - -: AUrl.go-rw-r--r--1XJK Staff 598B Mar - -: $Writing.go-rw-r--r--1XJK Staff 402B Mar - -: atBase64.go-rw-r--r--1XJK Staff 447B Mar to -: -Commandlineflags.go-rwxr-xr-x1XJK Staff1.7MMar to -: +commonlineargument-rw-r--r--1XJK Staff 209B Mar to -: -Commonlineargument.go-rw-r--r--1XJK Staff 261B APR1 -: GenevaEnvironmentvariables.go-rw-r--r--1XJK Staff 303B APR1 -: AExecingprocess.go-rw-r--r--1XJK Staff 298B Mar to -: theLinefilters.go-rw-r--r--1XJK Staff 384B Mar - -:GenevaNumber_parsing.go-rw-r--r--1XJK Staff 189B Mar - -: -Sha.go-rw-r--r--1XJK Staff 720B APR1 -: theSpawningprocess.go-rwxr-xr-x1XJK Staff 243B Mar - One: -urllib001.py
Summarize:
1: ....