Skip to content

Commit eaa4f1c

Browse files
committed
all: use -mod=readonly
1 parent 969ab07 commit eaa4f1c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docker/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# All rights reserved. Use of this source code is governed
33
# by a GPLv3 license that can be found in the LICENSE file.
44

5-
FROM golang:1.14-alpine
5+
FROM golang:1.15.3
66
WORKDIR /app
77
ADD . /app
88
# required for runtime/cgo
9-
RUN apk add g++
9+
RUN apt install g++
1010
RUN go get -u golang.org/x/tools/cmd/goimports && go mod tidy
11-
RUN go build -o ssaplayground.service -mod=mod
11+
RUN go build -o ssaplayground.service -mod=readonly
1212
EXPOSE 6789
1313
ENTRYPOINT [ "/app/ssaplayground.service", "-conf=/app/configs/docker.yaml"]

src/route/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ func initModules(path string) error {
184184
func buildSSA(funcname, gcflags, outf, buildf string, isTest bool) error {
185185
var cmd *exec.Cmd
186186
if !isTest {
187-
cmd = exec.Command("go", "build", fmt.Sprintf(`-gcflags=%s`, gcflags), "-o", outf, buildf)
187+
cmd = exec.Command("go", "build", "-mod=readonly", fmt.Sprintf(`-gcflags=%s`, gcflags), "-o", outf, buildf)
188188
} else {
189-
cmd = exec.Command("go", "test", fmt.Sprintf(`-gcflags=%s`, gcflags), buildf)
189+
cmd = exec.Command("go", "test", "-mod=readonly", fmt.Sprintf(`-gcflags=%s`, gcflags), buildf)
190190
}
191191
cmd.Env = append(os.Environ(), fmt.Sprintf("GOSSAFUNC=%s", funcname))
192192
cmd.Stderr = &bytes.Buffer{}

0 commit comments

Comments
 (0)