What's the appropriate Go shebang line?

后端 未结 6 755
情书的邮戳
情书的邮戳 2021-02-01 01:55

I like using shebangs to run my Perl scripts directly:

#!/usr/bin/env perl

What\'s the shebang for Go programs?

6条回答
  •  走了就别回头了
    2021-02-01 02:26

    /// 2>/dev/null; gorun "$0" "$@" ; exit $?

    Seems to me the best combination of the answers thus far. It uses gorun so it caches the compilation step (which speeds up your scripts greatly), and works on macOS, too.

    Install gorun with:

    go get github.com/erning/gorun

提交回复
热议问题