什么是合适的Go shebang线? [英] What's the appropriate Go shebang line?

查看:51
本文介绍了什么是合适的Go shebang线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢使用shebangs直接运行Perl脚本:

I like using shebangs to run my Perl scripts directly:

#!/usr/bin/env perl

什么是Go语言程序?

推荐答案

//usr/bin/go run $ 0 $ @;退出

示例:

//usr/bin/go run $0 $@ ; exit
package main

import "fmt"

func main() {
    fmt.Println("Hello World!")
}

//视为单行注释和外壳会忽略多余的/

go treat // as a single line comment and shell ignore extra /

这篇关于什么是合适的Go shebang线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆