You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// <param name="install">When true (default), automatically runs go mod tidy before the application starts. When false, this method does nothing.</param>
242
243
/// <param name="configureInstaller">Optional action to configure the installer resource.</param>
243
244
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
/// <param name="install">When true (default), automatically runs go mod download before the application starts. When false, this method does nothing.</param>
274
277
/// <param name="configureInstaller">Optional action to configure the installer resource.</param>
275
278
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/>.</returns>
Copy file name to clipboardExpand all lines: src/CommunityToolkit.Aspire.Hosting.Golang/README.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,14 @@ var golang = builder.AddGolangApp("golang", "../gin-api")
43
43
.WithHttpEndpoint(env: "PORT");
44
44
```
45
45
46
+
By default, `WithGoModTidy()` runs `go mod tidy` before the application starts (equivalent to `install: true`). You can disable this behavior by setting `install: false`:
.WithGoModTidy(install: false) // Does not run go mod tidy
51
+
.WithHttpEndpoint(env: "PORT");
52
+
```
53
+
46
54
### Using `go mod download`
47
55
48
56
To run `go mod download` before your application starts (to download dependencies without verification):
@@ -53,7 +61,15 @@ var golang = builder.AddGolangApp("golang", "../gin-api")
53
61
.WithHttpEndpoint(env: "PORT");
54
62
```
55
63
56
-
Both methods create an installer resource that runs before your application starts, ensuring dependencies are available. The installer resource appears as a child resource in the Aspire dashboard.
64
+
Similarly, you can control whether the download runs:
.WithGoModDownload(install: false) // Does not run go mod download
69
+
.WithHttpEndpoint(env: "PORT");
70
+
```
71
+
72
+
Both methods create an installer resource that runs before your application starts when `install` is `true`, ensuring dependencies are available. The installer resource appears as a child resource in the Aspire dashboard.
57
73
58
74
You can also customize the installer resource using the optional `configureInstaller` parameter:
59
75
@@ -66,7 +82,7 @@ var golang = builder.AddGolangApp("golang", "../gin-api")
66
82
.WithHttpEndpoint(env: "PORT");
67
83
```
68
84
69
-
> **Note:** The `WithGoModTidy` and `WithGoModDownload` methods only run during development. When publishing, the generated Dockerfile handles dependency management automatically.
85
+
> **Note:** The `WithGoModTidy` and `WithGoModDownload` methods only run in run mode (when the application is started locally). They do not run when publishing, as the generated Dockerfile handles dependency management automatically.
0 commit comments