Skip to content

Commit

Permalink
default go module to on
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
  • Loading branch information
cpanato authored and alexellis committed Feb 21, 2022
1 parent 4cf376c commit f299b05
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -27,8 +27,8 @@ The two templates are equivalent with `golang-http` using a structured request/r

You can manage dependencies in one of the following ways:

* 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
* 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`
* 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
* 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`
* For traditional vendoring with `dep` give no argument, or add `--build-arg GO111MODULE=off` to `faas-cli up`

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

##### Go sub-modules

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`.

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.

```Golang
Expand Down Expand Up @@ -439,3 +437,5 @@ func Handle(w http.ResponseWriter, r *http.Request) {
handlers.Echo(w, r)
}
```

If you have any vendor private dependency, you can disable the Go module via `faas-cli build --build-arg GO111MODULE=off`.
4 changes: 2 additions & 2 deletions template/golang-http/template.yml
Expand Up @@ -3,8 +3,8 @@ fprocess: ./handler
welcome_message: |
You have created a new function which uses Go 1.16.
To include third-party dependencies, use Go modules and use
"--build-arg GO111MODULE=on" with faas-cli build or configure this
To disable the go module, for private vendor code, please use
"--build-arg GO111MODULE=off" with faas-cli build or configure this
via your stack.yml file.
See more: https://docs.openfaas.com/cli/templates/
Expand Down
2 changes: 1 addition & 1 deletion template/golang-middleware/Dockerfile
Expand Up @@ -17,7 +17,7 @@ RUN mkdir -p /go/src/handler
WORKDIR /go/src/handler
COPY . .

ARG GO111MODULE="off"
ARG GO111MODULE="on"
ARG GOPROXY=""
ARG GOFLAGS=""
ARG DEBUG=0
Expand Down
4 changes: 2 additions & 2 deletions template/golang-middleware/template.yml
Expand Up @@ -3,8 +3,8 @@ fprocess: ./handler
welcome_message: |
You have created a new function which uses Go 1.16.
To include third-party dependencies, use Go modules and use
"--build-arg GO111MODULE=on" with faas-cli build or configure this
To disable the go module, for private vendor code, please use
"--build-arg GO111MODULE=off" with faas-cli build or configure this
via your stack.yml file.
See more: https://docs.openfaas.com/cli/templates/
Expand Down

0 comments on commit f299b05

Please sign in to comment.