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

Upgrade all references to go1.18 and replace go get with go install #474

Merged
merged 1 commit into from
Jul 23, 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Let's examine the `config.yaml` fields so you will feel more comfortable editing
| output_binary | /app | output binary artifact inside the runtime container |
| build_command | go build -o {{.output_binary}} | build command inside the runtime container. Note you can reference other configuration fields. When enabling Debugger `-gcflags="all=-N -l"` will be appended to the build command to stop compiler optimization and symbol removing |
| run_command | {.output_binary}} | run command, probably most of the time will just be the binary artifact path |
| runtime_image | golang:1.17 | base Docker image for the runtime container |
| runtime_image | golang:1.18 | base Docker image for the runtime container |
| debugger_enabled | false | whether to enable delve debugger inside the container or just use hot-reload |
| debugger_port | 40000 | delve debugger listen port, relevant only if `debugger_enabled` was set |
| expose_ports | [] | list of ports to expose inside the container. Uses the same syntax as docker-compose for mapping between host and container ports(e.g: "8080:8080"). No need to add the delve debugger listen port as it will be auto-added |
Expand Down
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Configurations
output_binary - output binary artifact inside the runtime container (default: "/app")
build_command - build command inside the runtime container (default: "go build -o {{.output_binary}}")
run_command - run command, probably most of the time will just be the binary artifact path (default: "{.output_binary}}")
runtime_image - base Docker image for the runtime container (default: "golang:1.17")
runtime_image - base Docker image for the runtime container (default: "golang:1.18")
debugger_enabled - whether to enable delve debugger inside the container or just use hot-reload (default: false)
debugger_port - delve debugger listen port, relevant only if debugger_enabled was set (default: 40000)
expose_ports - list of ports to expose inside the container (default: [])
Expand Down
12 changes: 6 additions & 6 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestConfig_Load(t *testing.T) {
name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}} -gcflags="all=-N-l"
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
expose_ports:
Expand All @@ -32,7 +32,7 @@ expose_ports:
OutputBinaryPath: "/app",
BuildCommand: `go build -o /app -gcflags="all=-N-l"`,
RunCommand: "/app",
RuntimeImage: "golang:1.17",
RuntimeImage: "golang:1.18",
DebuggerPort: 40000,
ExposePorts: []string{"8080:8080"},
},
Expand All @@ -43,7 +43,7 @@ expose_ports:
name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}} -gcflags="all=-N-l"
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
expose_ports:
Expand All @@ -54,7 +54,7 @@ expose_ports:
OutputBinaryPath: "/app",
BuildCommand: `go build -o /app -gcflags="all=-N-l"`,
RunCommand: "/app",
RuntimeImage: "golang:1.17",
RuntimeImage: "golang:1.18",
DebuggerPort: 40000,
ExposePorts: []string{"8080:8080"},
},
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestConfig_Write(t *testing.T) {
BuildCommand: "go build -o /app -gcflags=\"all=-N-l\"",
BuildDir: "/app",
RunCommand: "/app",
RuntimeImage: "golang:1.17",
RuntimeImage: "golang:1.18",
DebuggerPort: 40000,
DebuggerEnabled: true,
ExposePorts: []string{"8080", "8081:8081"},
Expand All @@ -133,7 +133,7 @@ output_binary: /app
build_command: go build -o /app -gcflags="all=-N-l"
build_dir: /app
run_command: /app
runtime_image: golang:1.17
runtime_image: golang:1.18
debugger_enabled: true
debugger_port: 40000
expose_ports:
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ networks:
// RenderDockerfile writes the Dockerfile to writer
func (c *Config) RenderDockerfile(writer io.Writer) error {
return c.renderedWrite(`FROM {{.RuntimeImage}}
RUN go get github.com/githubnemo/CompileDaemon
RUN go get github.com/go-delve/delve/cmd/dlv
RUN go install github.com/githubnemo/CompileDaemon@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest

{{- if .PreRunCommands}}{{range .PreRunCommands}}
RUN {{.}}{{end}}{{end}}
Expand Down
8 changes: 4 additions & 4 deletions pkg/config/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var mockConfig = &Config{
OutputBinaryPath: "/app",
BuildCommand: "go build",
RunCommand: "/app",
RuntimeImage: "golang:1.17",
RuntimeImage: "golang:1.18",
DebuggerEnabled: false,
DebuggerPort: 0,
ExposePorts: []string{"8080"},
Expand Down Expand Up @@ -88,9 +88,9 @@ func TestConfig_RenderDockerfile(t *testing.T) {
err := mockConfig.RenderDockerfile(out)
assert.NoError(t, err)
assert.Equal(t,
`FROM golang:1.17
RUN go get github.com/githubnemo/CompileDaemon
RUN go get github.com/go-delve/delve/cmd/dlv
`FROM golang:1.18
RUN go install github.com/githubnemo/CompileDaemon@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest
WORKDIR /src
COPY . .

Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_docker_compose_0.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}}
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
debugger_enabled: true
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_docker_compose_1.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}}
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
debugger_enabled: false
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_docker_compose_2.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}}
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
debugger_enabled: false
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_docker_compose_3.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}}
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
debugger_enabled: false
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_docker_compose_4.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}}
run_command: '{{.output_binary}}'
runtime_image: golang:1.17
runtime_image: golang:1.18
debugger_enabled: true
debugger_port: 40000
expose_ports: []
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/testdata/generate_dockerfile_0.golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.17
RUN go get github.com/githubnemo/CompileDaemon
RUN go get github.com/go-delve/delve/cmd/dlv
FROM golang:1.18
RUN go install github.com/githubnemo/CompileDaemon@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest
WORKDIR /src
COPY . .

Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_dockerfile_0.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}}
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
debugger_enabled: true
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/testdata/generate_dockerfile_1.golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.17
RUN go get github.com/githubnemo/CompileDaemon
RUN go get github.com/go-delve/delve/cmd/dlv
FROM golang:1.18
RUN go install github.com/githubnemo/CompileDaemon@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest
WORKDIR /src
COPY . .

Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_dockerfile_1.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}}
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
debugger_enabled: false
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/testdata/generate_dockerfile_2.golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.17
RUN go get github.com/githubnemo/CompileDaemon
RUN go get github.com/go-delve/delve/cmd/dlv
FROM golang:1.18
RUN go install github.com/githubnemo/CompileDaemon@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest
WORKDIR /src
COPY . .

Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_dockerfile_2.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: my-app
output_binary: /app
build_command: go build -o {{.output_binary}}
build_dir: /src
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
debugger_enabled: false
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/testdata/generate_dockerfile_3.golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:1.17
RUN go get github.com/githubnemo/CompileDaemon
RUN go get github.com/go-delve/delve/cmd/dlv
FROM golang:1.18
RUN go install github.com/githubnemo/CompileDaemon@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest
RUN echo "hello" && echo "world"
RUN ls
WORKDIR /src
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/testdata/generate_dockerfile_3.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pre_run_commands:
- ls
build_command: go build -o {{.output_binary}}
build_dir: /src
runtime_image: golang:1.17
runtime_image: golang:1.18
run_command: '{{.output_binary}}'
debugger_port: 40000
debugger_enabled: false
Expand Down
2 changes: 1 addition & 1 deletion pkg/input/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func LoadOrDefault(workDir string) (*config.Config, bool) {
OutputBinaryPath: "/app",
BuildCommand: `go build -o {{.output_binary}}`,
RunCommand: `{{.output_binary}}`,
RuntimeImage: "golang:1.17",
RuntimeImage: "golang:1.18",
}

configFilePath := config.FilePath(workDir, config.Path)
Expand Down
2 changes: 1 addition & 1 deletion webui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17
FROM golang:1.18
RUN apt-get update
RUN apt-get install -y git python jq curl

Expand Down