What's the appropriate Go shebang line?

后端 未结 6 767
情书的邮戳
情书的邮戳 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:06

    Go programs are compiled to binaries; I don't think there is an option to run them directly from source.

    This is similar to other compiled languages such as C++ or Java. Some languages (such as Haskell) offer both a fully compiled mode and a "script" mode which you can run directly from source with a shebang line.

提交回复
热议问题