File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
examples/singleapp/static_linked_binary Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ app.dynamic
2+ app.static
3+ static_linked_binary
Original file line number Diff line number Diff line change 1+ default : \
2+ dynamiclinked \
3+ staticlinked \
4+ showinfo \
5+ lddinfo \
6+ execdynamic \
7+ execstatic
8+
9+ dynamiclinked :
10+ go build -o app.dynamic
11+
12+ staticlinked :
13+ CGO_ENABLED=0 go build -o app.static
14+
15+ showinfo :
16+ @echo ' [info] app.dynamic: ' ; file app.dynamic | tr , ' \n' | grep -F ' linked'
17+ @echo ' [info] app.static: ' ; file app.static | tr , ' \n' | grep -F ' linked'
18+
19+ lddinfo :
20+ @echo ' [ldd ] app.dynamic: ' ; ldd app.dynamic || :
21+ @echo ' [ldd ] app.static: ' ; ldd app.static || :
22+
23+ execdynamic :
24+ @echo ' [exec] app.dynamic: ' ; sudo chroot . ./app.dynamic || :
25+
26+ execstatic :
27+ @echo ' [exec] app.static: ' ; sudo chroot . ./app.static || :
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "fmt"
5+ "log"
6+ "os/user"
7+ )
8+
9+ func main () {
10+ u , err := user .Current ()
11+ if err != nil {
12+ log .Fatalln (err )
13+ }
14+
15+ fmt .Printf ("Username: %s\n " , u .Username )
16+ }
You can’t perform that action at this time.
0 commit comments