init
This commit is contained in:
14
,
Executable file
14
,
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
script_path=$(realpath $0)
|
||||
script_dir=$(dirname $script_path)
|
||||
|
||||
cd $script_dir
|
||||
|
||||
output=/tmp/commandgo
|
||||
|
||||
# 为什么不直接使用 go run . 呢
|
||||
# 因为 go run 编译时会往 PATH 里注入 Go 的 bin 目录,这个修改过后的 PATH 会传递给子进程
|
||||
# 于是程序运行起来时获取的 PATH 环境变量和外界不一致,因此不用 go run . 编译运行
|
||||
go build -o $output . && $output $@
|
||||
|
||||
Reference in New Issue
Block a user