Use go modules

This commit is contained in:
nemunaire 2021-05-13 23:47:18 +02:00
parent 99862b6daa
commit 9dc1f401b7
11 changed files with 82 additions and 70 deletions

View File

@ -23,8 +23,6 @@ steps:
- go get -v -d srs.epita.fr/fic-server/repochecker - go get -v -d srs.epita.fr/fic-server/repochecker
- go get -v -d srs.epita.fr/fic-server/qa - go get -v -d srs.epita.fr/fic-server/qa
- mkdir deploy - mkdir deploy
environment:
GO111MODULE: off
- name: vet - name: vet
image: golang:alpine image: golang:alpine
@ -36,8 +34,6 @@ steps:
- go vet -v srs.epita.fr/fic-server/dashboard - go vet -v srs.epita.fr/fic-server/dashboard
- go vet -v srs.epita.fr/fic-server/repochecker - go vet -v srs.epita.fr/fic-server/repochecker
- go vet -v srs.epita.fr/fic-server/qa - go vet -v srs.epita.fr/fic-server/qa
environment:
GO111MODULE: off
- name: build admin - name: build admin
image: golang:alpine image: golang:alpine
@ -46,7 +42,6 @@ steps:
- tar chjf deploy/htdocs-admin.tar.bz2 htdocs-admin - tar chjf deploy/htdocs-admin.tar.bz2 htdocs-admin
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build backend - name: build backend
image: golang:alpine image: golang:alpine
@ -54,7 +49,6 @@ steps:
- go build -v -o deploy/backend-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/backend - go build -v -o deploy/backend-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/backend
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build frontend - name: build frontend
image: golang:alpine image: golang:alpine
@ -63,7 +57,6 @@ steps:
- tar chjf deploy/htdocs-frontend.tar.bz2 htdocs-frontend - tar chjf deploy/htdocs-frontend.tar.bz2 htdocs-frontend
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build dashboard - name: build dashboard
image: golang:alpine image: golang:alpine
@ -72,7 +65,6 @@ steps:
- tar chjf deploy/htdocs-dashboard.tar.bz2 htdocs-dashboard - tar chjf deploy/htdocs-dashboard.tar.bz2 htdocs-dashboard
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build repochecker - name: build repochecker
image: golang:alpine image: golang:alpine
@ -81,7 +73,6 @@ steps:
- grep "const version" repochecker/update.go | sed -r 's/^.*=\s*(\S.*)$/\1/' > deploy/repochecker.version - grep "const version" repochecker/update.go | sed -r 's/^.*=\s*(\S.*)$/\1/' > deploy/repochecker.version
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build repochecker for macOS - name: build repochecker for macOS
image: golang:alpine image: golang:alpine
@ -91,7 +82,6 @@ steps:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOOS: darwin GOOS: darwin
GOARCH: amd64 GOARCH: amd64
GO111MODULE: off
- name: build qa - name: build qa
image: golang:alpine image: golang:alpine
@ -100,7 +90,6 @@ steps:
- tar chjf deploy/htdocs-qa.tar.bz2 htdocs-qa - tar chjf deploy/htdocs-qa.tar.bz2 htdocs-qa
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: deploy - name: deploy
image: appleboy/drone-scp image: appleboy/drone-scp
@ -214,8 +203,6 @@ steps:
- go get -v -d srs.epita.fr/fic-server/backend - go get -v -d srs.epita.fr/fic-server/backend
- go get -v -d srs.epita.fr/fic-server/frontend - go get -v -d srs.epita.fr/fic-server/frontend
- go get -v -d srs.epita.fr/fic-server/dashboard - go get -v -d srs.epita.fr/fic-server/dashboard
environment:
GO111MODULE: off
- name: build admin - name: build admin
image: golang:alpine image: golang:alpine
@ -223,7 +210,6 @@ steps:
- go build -v -o deploy/admin-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/admin - go build -v -o deploy/admin-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/admin
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build backend - name: build backend
image: golang:alpine image: golang:alpine
@ -231,7 +217,6 @@ steps:
- go build -v -o deploy/backend-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/backend - go build -v -o deploy/backend-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/backend
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build frontend - name: build frontend
image: golang:alpine image: golang:alpine
@ -239,7 +224,6 @@ steps:
- go build -v -o deploy/frontend-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/frontend - go build -v -o deploy/frontend-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/frontend
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build dashboard - name: build dashboard
image: golang:alpine image: golang:alpine
@ -247,7 +231,6 @@ steps:
- go build -v -o deploy/dashboard-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/dashboard - go build -v -o deploy/dashboard-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/dashboard
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build repochecker - name: build repochecker
image: golang:alpine image: golang:alpine
@ -255,7 +238,6 @@ steps:
- go build -v -o deploy/repochecker-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/repochecker - go build -v -o deploy/repochecker-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/repochecker
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: build repochecker for macOS - name: build repochecker for macOS
image: golang:alpine image: golang:alpine
@ -266,7 +248,6 @@ steps:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOOS: darwin GOOS: darwin
GOARCH: arm64 GOARCH: arm64
GO111MODULE: off
- name: build qa - name: build qa
image: golang:alpine image: golang:alpine
@ -274,7 +255,6 @@ steps:
- go build -v -o deploy/qa-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/qa - go build -v -o deploy/qa-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/qa
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
GO111MODULE: off
- name: deploy - name: deploy
image: appleboy/drone-scp image: appleboy/drone-scp

View File

@ -2,19 +2,15 @@ FROM golang:alpine as gobuild
RUN apk add --no-cache git RUN apk add --no-cache git
ENV GO111MODULE=off WORKDIR /go/src/srs.epita.fr/fic-server/
WORKDIR /go/src/srs.epita.fr/fic-server/admin ADD go.mod go.sum ./
ADD settings settings/
ADD libfic ./libfic/
ADD admin ./admin/
ADD settings ../settings/ RUN go get -d -v ./admin
ADD libfic ../libfic/ RUN go build -v -o admin/admin ./admin
ADD admin/api ./api/
ADD admin/pki ./pki/
ADD admin/sync ./sync/
ADD admin/*.go ./
RUN go get -d -v
RUN go build -v
FROM alpine FROM alpine

View File

@ -2,16 +2,15 @@ FROM golang:alpine as gobuild
RUN apk add --no-cache git RUN apk add --no-cache git
ENV GO111MODULE=off WORKDIR /go/src/srs.epita.fr/fic-server/
WORKDIR /go/src/srs.epita.fr/fic-server/backend ADD go.mod go.sum ./
ADD settings settings/
ADD libfic ./libfic/
ADD backend ./backend/
ADD backend/*.go ./ RUN go get -d -v ./backend
ADD libfic ../libfic/ RUN go build -v -o backend/backend ./backend
ADD settings ../settings/
RUN go get -d -v
RUN go build -v
FROM alpine FROM alpine

View File

@ -2,17 +2,15 @@ FROM golang:alpine as gobuild
RUN apk add --no-cache git RUN apk add --no-cache git
ENV GO111MODULE=off WORKDIR /go/src/srs.epita.fr/fic-server/
WORKDIR /go/src/srs.epita.fr/fic-server/dashboard ADD go.mod go.sum ./
ADD settings settings/
ADD libfic ./libfic/
ADD dashboard ./dashboard/
ADD dashboard/*.go ./ RUN go get -d -v ./dashboard
ADD dashboard/api/*.go ./api/ RUN go build -v -o dashboard/dashboard ./dashboard
ADD libfic ../libfic/
ADD settings ../settings/
RUN go get -d -v
RUN go build -v
FROM alpine FROM alpine

View File

@ -2,16 +2,15 @@ FROM golang:alpine as gobuild
RUN apk add --no-cache git RUN apk add --no-cache git
ENV GO111MODULE=off WORKDIR /go/src/srs.epita.fr/fic-server/
WORKDIR /go/src/srs.epita.fr/fic-server/frontend ADD go.mod go.sum ./
ADD settings settings/
ADD libfic ./libfic/
ADD frontend ./frontend/
ADD frontend/*.go ./ RUN go get -d -v ./frontend
ADD libfic ../libfic/ RUN go build -v -o ./frontend/frontend ./frontend
ADD settings ../settings/
RUN go get -d -v
RUN go build -v
FROM alpine FROM alpine

View File

@ -2,17 +2,15 @@ FROM golang:alpine as gobuild
RUN apk add --no-cache git RUN apk add --no-cache git
ENV GO111MODULE=off WORKDIR /go/src/srs.epita.fr/fic-server/
WORKDIR /go/src/srs.epita.fr/fic-server/qa ADD go.mod go.sum ./
ADD settings settings/
ADD libfic ./libfic/
ADD qa ./qa/
ADD qa/*.go ./ RUN go get -d -v ./qa
ADD qa/api/*.go ./api/ RUN go build -v -o qa/qa ./qa
ADD libfic ../libfic/
ADD settings ../settings/
RUN go get -d -v
RUN go build -v
FROM alpine FROM alpine

View File

@ -8,7 +8,7 @@ import (
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/julienschmidt/httprouter" "github.com/julienschmidt/httprouter"
"gopkg.in/russross/blackfriday.v2" "github.com/russross/blackfriday/v2"
"srs.epita.fr/fic-server/libfic" "srs.epita.fr/fic-server/libfic"
) )

View File

@ -10,8 +10,8 @@ import (
"srs.epita.fr/fic-server/libfic" "srs.epita.fr/fic-server/libfic"
"github.com/russross/blackfriday/v2"
"golang.org/x/crypto/blake2b" "golang.org/x/crypto/blake2b"
"gopkg.in/russross/blackfriday.v2"
) )
func ProcessMarkdown(i Importer, input string, rootDir string) (output string, err error) { func ProcessMarkdown(i Importer, input string, rootDir string) (output string, err error) {
@ -52,7 +52,7 @@ func ProcessMarkdown(i Importer, input string, rootDir string) (output string, e
} else { } else {
defer fdto.Close() defer fdto.Close()
writer := bufio.NewWriter(fdto) writer := bufio.NewWriter(fdto)
if err = getFile(i, rootDir + iPath, writer); err != nil { if err = getFile(i, rootDir+iPath, writer); err != nil {
os.Remove(dPath) os.Remove(dPath)
return return
} }

View File

@ -12,8 +12,9 @@ import (
"unicode" "unicode"
"github.com/julienschmidt/httprouter" "github.com/julienschmidt/httprouter"
"github.com/russross/blackfriday/v2"
"golang.org/x/image/draw" "golang.org/x/image/draw"
"gopkg.in/russross/blackfriday.v2"
"srs.epita.fr/fic-server/libfic" "srs.epita.fr/fic-server/libfic"
) )

15
go.mod Normal file
View File

@ -0,0 +1,15 @@
module srs.epita.fr/fic-server
go 1.9
require (
github.com/BurntSushi/toml v0.3.1
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-sql-driver/mysql v1.6.0
github.com/julienschmidt/httprouter v1.3.0
github.com/russross/blackfriday/v2 v2.1.0
github.com/studio-b12/gowebdav v0.0.0-20210427212133-86f8378cf140
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e
gopkg.in/fsnotify.v1 v1.4.7
)

26
go.sum Normal file
View File

@ -0,0 +1,26 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
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/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/studio-b12/gowebdav v0.0.0-20210427212133-86f8378cf140 h1:JCSn/2k3AQ0aJGs5Yx2xv6qrW0CAULc1E+xtSxeeQ/E=
github.com/studio-b12/gowebdav v0.0.0-20210427212133-86f8378cf140/go.mod h1:gCcfDlA1Y7GqOaeEKw5l9dOGx1VLdc/HuQSlQAaZ30s=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e h1:PzJMNfFQx+QO9hrC1GwZ4BoPGeNGhfeQEgcQFArEjPk=
golang.org/x/image v0.0.0-20210504121937-7319ad40d33e/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=