-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable go module support for go environment (#1152)
- Loading branch information
Showing
46 changed files
with
131 additions
and
6,539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ARG GO_VERSION=1.12.7 | ||
|
||
FROM ubuntu:18.04 AS base | ||
WORKDIR / | ||
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/* | ||
|
||
FROM golang:${GO_VERSION} AS builder | ||
|
||
ENV GOPATH /usr | ||
ENV APP ${GOPATH}/src/github.com/fission/fission/environments/go | ||
|
||
WORKDIR ${APP} | ||
|
||
ADD context ${APP}/context | ||
ADD server.go ${APP} | ||
|
||
RUN go get | ||
RUN go build -a -o /server server.go | ||
|
||
FROM base | ||
COPY --from=builder /server / | ||
|
||
ENTRYPOINT ["/server"] | ||
EXPOSE 8888 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ARG BUILDER_IMAGE=fission/builder | ||
ARG GO_VERSION=1.12.7 | ||
|
||
FROM ${BUILDER_IMAGE} | ||
|
||
FROM golang:${GO_VERSION} | ||
|
||
ENV GOPATH /usr | ||
ENV GO111MODULE on | ||
WORKDIR ${GOPATH} | ||
|
||
COPY --from=0 /builder /builder | ||
ADD build.sh /usr/local/bin/build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Go module usage | ||
|
||
1. Initialize your project | ||
|
||
```bash | ||
$ go mod init "<module>" | ||
``` | ||
|
||
For example, | ||
|
||
```bash | ||
$ go mod init "github.com/fission/fission/examples/go/go-module-example" | ||
``` | ||
|
||
2. Add dependencies | ||
|
||
* See [here](https://github.com/golang/go/wiki/Modules#daily-workflow) | ||
|
||
3. Verify | ||
|
||
```bash | ||
$ go mod verify | ||
``` | ||
|
||
4. Archive and create package as usual | ||
|
||
```bash | ||
$ zip -r go.zip . | ||
adding: go.mod (deflated 26%) | ||
adding: go.sum (deflated 1%) | ||
adding: README.md (deflated 37%) | ||
adding: main.go (deflated 30%) | ||
|
||
$ fission pkg create --env go --src go.zip | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/fission/fission/examples/go/go-module-example | ||
|
||
require github.com/golang/example v0.0.0-20170904185048-46695d81d1fa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github.com/golang/example v0.0.0-20170904185048-46695d81d1fa/go.mod h1:tO/5UvQ/uKigUjQBPqzstj6uxd3fUIjddi19DxGJeWg= |
File renamed without changes.
202 changes: 0 additions & 202 deletions
202
examples/go/vendor-example/vendor/github.com/golang/example/LICENSE
This file was deleted.
Oops, something went wrong.
65 changes: 0 additions & 65 deletions
65
examples/go/vendor-example/vendor/github.com/golang/example/README.md
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...es/go/vendor-example/vendor/github.com/golang/example/appengine-hello/README.md
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.