Skip to content

Commit

Permalink
ci: upgrade Go and some actions version
Browse files Browse the repository at this point in the history
  • Loading branch information
justin0u0 committed Mar 5, 2024
1 parent 3fb101a commit 480127d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
uses: actions/checkout@v3

- name: setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.17
go-version: '1.21'

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: v1.44.2
version: v1.55.2

# test should be run inside a container to start helper services (ex: mongo)
test:
runs-on: ubuntu-20.04
container: golang:1.17
runs-on: ubuntu-22.04
container: golang:1.21
services:
mongo:
image: mongo:5
Expand Down
10 changes: 1 addition & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
Expand Down Expand Up @@ -69,7 +61,6 @@ linters:
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
Expand Down Expand Up @@ -106,6 +97,7 @@ linters:

# don't enable:
# - asciicheck
# - depguard
# - scopelint
# - gochecknoglobals
# - gocognit
Expand Down
4 changes: 3 additions & 1 deletion cmd/comment/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"net"
"net/http"
"time"

"github.com/NTHU-LSALAB/NTHU-Distributed-System/modules/comment/pb"
"github.com/NTHU-LSALAB/NTHU-Distributed-System/pkg/grpckit"
Expand Down Expand Up @@ -72,7 +73,8 @@ func serveHTTP(lis net.Listener, conn *grpc.ClientConn, logger *logkit.Logger) r
mux := runtime.NewServeMux()

httpServer := &http.Server{
Handler: mux,
Handler: mux,
ReadHeaderTimeout: 10 * time.Second,
}

return func(ctx context.Context) error {
Expand Down
7 changes: 4 additions & 3 deletions modules/video/dao/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func listVideoKey(limit, skip int64) string {
// id that is useful for testing
func NewFakeVideo() *Video {
id := primitive.NewObjectID()
baseURL := "https://storage.example.com/videos/" + id.Hex()

// Note that timestamp is hard to test equally,
// so ignore the `createdAt` and `updatedAt` field
Expand All @@ -87,11 +88,11 @@ func NewFakeVideo() *Video {
Height: 600,
Size: 144000,
Duration: 10.234,
URL: "https://storage.example.com/videos/" + id.Hex() + ".mp4",
URL: baseURL + ".mp4",
Status: VideoStatusSuccess,
Variants: map[string]string{
"1080p": "https://storage.example.com/videos/" + id.Hex() + "-1080p.mp4",
"720p": "https://storage.example.com/videos/" + id.Hex() + "-720p.mp4",
"1080p": baseURL + "-1080p.mp4",
"720p": baseURL + "-720p.mp4",
},
}
}

0 comments on commit 480127d

Please sign in to comment.