> For the complete documentation index, see [llms.txt](https://denglj.gitbook.io/essential-go/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://denglj.gitbook.io/essential-go/common-standard-libraries/56-the-go-command/go-run.md).

# go run

`go run`会不创建可执行文件而运行程序。这对开发很有用。`run`将仅执行软件包名称为`main`的软件包。

为了演示，我们将使用一个简单的Hello World示例main.go：

```go
package main

import fmt

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

在不编译的情况下运行它：`go run main.go`

### 运行包中的多个文件

如果程序分为多个文件，则必须提供所有文件：

```bash
go run main.go assets.go
```
