Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default go module to on #63

Merged
merged 1 commit into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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