doc/md: add -mod=mod to 'go run' commands in documentation (#2881)

https://go.dev/ref/mod#build-commands is the documentation for the -mod flag. It seems that basically -mod=mod is never harmful in ent's case, all it does is tell the go command that it can add ent to the go.mod file if it's not already present
This commit is contained in:
Bill Mill
2022-08-23 14:15:30 -04:00
committed by GitHub
parent 4467021c6c
commit f3b6dd9d7e
6 changed files with 9 additions and 18 deletions

View File

@@ -27,21 +27,12 @@ GOPATH, setup a [Go module](https://github.com/golang/go/wiki/Modules#quick-star
go mod init <project>
```
## Installation
```console
go install entgo.io/ent/cmd/ent@latest
```
After installing `ent` codegen tool, use `go run entgo.io/ent/cmd/ent <command>` to execute
commands.
## Create Your First Schema
Go to the root directory of your project, and run:
```console
go run entgo.io/ent/cmd/ent init User
go run -mod=mod entgo.io/ent/cmd/ent init User
```
The command above will generate the schema for `User` under `<project>/ent/schema/` directory:
@@ -272,7 +263,7 @@ Let's create 2 additional entities named `Car` and `Group` with a few fields. We
to generate the initial schemas:
```console
go run entgo.io/ent/cmd/ent init Car Group
go run -mod=mod entgo.io/ent/cmd/ent init Car Group
```
And then we add the rest of the fields manually: