Skip to content

Commit 38eb9b9

Browse files
committed
default go module to on
Signed-off-by: Carlos Panato <[email protected]>
1 parent c646a79 commit 38eb9b9

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ The two templates are equivalent with `golang-http` using a structured request/r
2727

2828
You can manage dependencies in one of the following ways:
2929

30-
* To use Go modules without vendoring, add `--build-arg GO111MODULE=on` to `faas-cli up`, you can also use `--build-arg GOPROXY=https://` if you want to use your own mirror for the modules
31-
* You can also Go modules with vendoring, run `go mod vendor` in your function folder and add `--build-arg GO111MODULE=on` to `faas-cli up`
30+
* To use Go modules without vendoring, the default already is set `GO111MODULE=on` but you also can make that explicity by adding `--build-arg GO111MODULE=on` to `faas-cli up`, you can also use `--build-arg GOPROXY=https://` if you want to use your own mirror for the modules
31+
* You can also Go modules with vendoring, run `go mod vendor` in your function folder and add `--build-arg GO111MODULE=off` to `faas-cli up`
3232
* For traditional vendoring with `dep` give no argument, or add `--build-arg GO111MODULE=off` to `faas-cli up`
3333

3434
## 1.0 golang-http
@@ -394,8 +394,6 @@ This replacement is handled gracefully by the template at build time and your lo
394394

395395
##### Go sub-modules
396396

397-
For this example you will need to be using Go 1.13 or newer and Go modules, enable this via `faas-cli build --build-arg GO111MODULE=on`.
398-
399397
Imagine you have a package which you want to store outside of the `handler.go` file, it's another middleware which can perform an echo of the user's input.
400398

401399
```Golang
@@ -439,3 +437,5 @@ func Handle(w http.ResponseWriter, r *http.Request) {
439437
handlers.Echo(w, r)
440438
}
441439
```
440+
441+
If you have any vendor private dependency, you can disable the Go module via `faas-cli build --build-arg GO111MODULE=off`.

template/golang-http/template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ fprocess: ./handler
33
welcome_message: |
44
You have created a new function which uses Go 1.16.
55
6-
To include third-party dependencies, use Go modules and use
7-
"--build-arg GO111MODULE=on" with faas-cli build or configure this
6+
To disable the go module, for private vendor code, please use
7+
"--build-arg GO111MODULE=off" with faas-cli build or configure this
88
via your stack.yml file.
99
1010
See more: https://docs.openfaas.com/cli/templates/

template/golang-middleware/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN mkdir -p /go/src/handler
1717
WORKDIR /go/src/handler
1818
COPY . .
1919

20-
ARG GO111MODULE="off"
20+
ARG GO111MODULE="on"
2121
ARG GOPROXY=""
2222
ARG GOFLAGS=""
2323
ARG DEBUG=0

template/golang-middleware/template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ fprocess: ./handler
33
welcome_message: |
44
You have created a new function which uses Go 1.16.
55
6-
To include third-party dependencies, use Go modules and use
7-
"--build-arg GO111MODULE=on" with faas-cli build or configure this
6+
To disable the go module, for private vendor code, please use
7+
"--build-arg GO111MODULE=off" with faas-cli build or configure this
88
via your stack.yml file.
99
1010
See more: https://docs.openfaas.com/cli/templates/

0 commit comments

Comments
 (0)