Skip to content

Commit

Permalink
Linter fixup and demo
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderstephan committed Dec 19, 2023
1 parent 7e37435 commit 423c58a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# For a description for each linter, see https://golangci-lint.run/usage/linters/.
linters:
enable:
- gosimple
Expand All @@ -14,7 +15,6 @@ linters:
- ineffassign
- gofumpt
- revive
- depguard
- nakedret
- unconvert
- wastedassign
Expand Down Expand Up @@ -73,7 +73,8 @@ issues:
max-issues-per-linter: 0
max-same-issues: 0
new: true
new-from-rev: HEAD
new-from-rev: bd63a53f
fix: false
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
Expand Down
5 changes: 3 additions & 2 deletions api/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package api

import (
"fmt"
"net/http"
"strconv"

"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/gin-gonic/gin"
"net/http"
"strconv"
)

func configMaintenanceRouter(router *gin.Engine, daoWrapper dao.DaoWrapper) {
Expand Down
5 changes: 3 additions & 2 deletions api/server-notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package api

import (
"fmt"
"net/http"
"time"

"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
"github.com/TUM-Dev/gocast/tools"
"github.com/gin-gonic/gin"
"net/http"
"time"
)

func configServerNotificationsRoutes(engine *gin.Engine, daoWrapper dao.DaoWrapper) {
Expand Down
1 change: 0 additions & 1 deletion api/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ func (r usersRoutes) updateCustomSpeeds(c *gin.Context) {
})
return
}

}

func (r usersRoutes) updatePlaybackSpeeds(c *gin.Context) {
Expand Down
17 changes: 9 additions & 8 deletions cmd/tumlive/tumlive.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ package main

import (
"fmt"
"log/slog"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"syscall"
"time"

"github.com/TUM-Dev/gocast/api"
"github.com/TUM-Dev/gocast/dao"
"github.com/TUM-Dev/gocast/model"
Expand All @@ -17,13 +25,6 @@ import (
"github.com/pkg/profile"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"log/slog"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"syscall"
"time"
)

var VersionTag = "development"
Expand Down Expand Up @@ -101,7 +102,7 @@ func main() {
}()

// log with time, fmt "23.09.2021 10:00:00"
//log.SetFormatter(&log.TextFormatter{TimestampFormat: "02.01.2006 15:04:05", FullTimestamp: true})
// log.SetFormatter(&log.TextFormatter{TimestampFormat: "02.01.2006 15:04:05", FullTimestamp: true})

web.VersionTag = VersionTag
osSignal = make(chan os.Signal, 1)
Expand Down
9 changes: 3 additions & 6 deletions model/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,9 @@ func (u *User) GetEnabledPlaybackSpeeds() (res []float32) {
if u == nil {
return []float32{1}
}
for _, setting := range u.GetPlaybackSpeeds().GetEnabled() {
res = append(res, setting)
}
for _, setting := range u.GetCustomSpeeds() {
res = append(res, setting)
}
// Possibly, this could be collapsed into a single line, but readibility suffers.
res = append(res, u.GetPlaybackSpeeds().GetEnabled()...)
res = append(res, u.GetCustomSpeeds()...)
sort.SliceStable(res, func(i, j int) bool {
return res[i] < res[j]
})
Expand Down

0 comments on commit 423c58a

Please sign in to comment.