Browse Source

⬆️ Build Goji with Go modules, Go 1.19 and `GOAMD64=v3` (#7600)

* 🚚 Move template folder in src

This allows testing (building/running) outside of the Dockerfile.

* ⬆️ Bump Go from 1.14 to 1.19

* 🎨 Drop deprecated Go stuff from Dockerfile

* ⚡️ Set GOAMD64=v3 for AVX2, SSE4.2… instructions

See https://github.com/golang/go/wiki/MinimumRequirements#amd64

* ✨ Add `go.mod` in src (Go modules)
0uep 2 years ago
parent
commit
4f16e762af

+ 3 - 11
frameworks/Go/goji/goji.dockerfile

@@ -1,17 +1,9 @@
-FROM golang:1.14
+FROM docker.io/golang:1.19
 
-ADD ./ /goji
+ADD ./src /goji
 WORKDIR /goji
 
-RUN mkdir bin
-ENV GOPATH /goji
-ENV PATH ${GOPATH}/bin:${PATH}
-
-RUN go get github.com/go-sql-driver/mysql
-RUN go get github.com/zenazn/goji
-RUN go get github.com/zenazn/goji/web
-
-RUN go build -o server src/goji/server.go
+RUN GOAMD64=v3 go build -o server ./goji/server.go
 
 EXPOSE 8080
 

+ 8 - 0
frameworks/Go/goji/src/go.mod

@@ -0,0 +1,8 @@
+module server
+
+go 1.19
+
+require (
+	github.com/go-sql-driver/mysql v1.6.0
+	github.com/zenazn/goji v1.0.1
+)

+ 4 - 0
frameworks/Go/goji/src/go.sum

@@ -0,0 +1,4 @@
+github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
+github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/zenazn/goji v1.0.1 h1:4lbD8Mx2h7IvloP7r2C0D6ltZP6Ufip8Hn0wmSK5LR8=
+github.com/zenazn/goji v1.0.1/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=

+ 0 - 0
frameworks/Go/goji/templates/fortune.html → frameworks/Go/goji/src/templates/fortune.html


+ 0 - 0
frameworks/Go/goji/templates/layout.html → frameworks/Go/goji/src/templates/layout.html