Skip to content

Commit

Permalink
Fixed some bugs caused from gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
SebiWrn committed Jan 11, 2024
1 parent f4552ba commit 033666d
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion api/worker_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ func getLivePreviewFromWorker(s *model.Stream, workerID string, client pb.ToWork
return err
}

if err := os.MkdirAll(pathprovider.TUMLiveTemporary, 0o750); err != nil {
if err := os.MkdirAll(pathprovider.TUMLiveTemporary, 0750); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/modelGen/modelGen.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
}

fmt.Println("Generating model...")
model_file, err := os.OpenFile(fmt.Sprintf("model/%s.go", d.NamePrivate), os.O_WRONLY|os.O_CREATE, 0o644)
model_file, err := os.OpenFile(fmt.Sprintf("model/%s.go", d.NamePrivate), os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
fmt.Println(err)
os.Exit(1)
Expand All @@ -46,7 +46,7 @@ func main() {

fmt.Println("Generating dao...")

dao_file, err := os.OpenFile(fmt.Sprintf("dao/%s.go", d.NamePrivate), os.O_WRONLY|os.O_CREATE, 0o644)
dao_file, err := os.OpenFile(fmt.Sprintf("dao/%s.go", d.NamePrivate), os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
fmt.Println(err)
os.Exit(1)
Expand Down
6 changes: 2 additions & 4 deletions tools/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ import (
"github.com/spf13/viper"
)

var (
Cfg Config
Loc *time.Location
)
var Cfg Config
var Loc *time.Location

func LoadConfig() {
initCache()
Expand Down
4 changes: 2 additions & 2 deletions worker/cfg/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ func SetConfig() {
if PersistDir == "" {
PersistDir = "."
}
err := os.MkdirAll(PersistDir, 0o755)
err := os.MkdirAll(PersistDir, 0755)
if err != nil {
log.Error(err)
}
err = os.MkdirAll(LogDir, 0o755)
err = os.MkdirAll(LogDir, 0755)
if err != nil {
log.Warn("Could not create log directory: ", err)
}
Expand Down
2 changes: 1 addition & 1 deletion worker/edge/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func fetchFile(host, file string) error {
return fmt.Errorf("parse file path: %s", file)
}
d := filepath.Dir(diskDir)
err = os.MkdirAll(d, 0o755)
err = os.MkdirAll(d, 0755)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion worker/worker/persist.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const persistFileName = "/persist.gob"

// writeOut writes out the persistable object to disk
func (p *Persistable) writeOut() error {
f, err := os.OpenFile(cfg.PersistDir+persistFileName, os.O_RDWR|os.O_CREATE, 0o666)
f, err := os.OpenFile(cfg.PersistDir+persistFileName, os.O_RDWR|os.O_CREATE, 0666)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion worker/worker/premiere.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func streamPremiere(ctx *StreamContext) {
"-acodec", "aac", "-b:a", "128k", "-ac", "2", "-ar", "48000", "-af", "aresample=async=1:min_hard_comp=0.100000:first_pts=0",
"-f", "flv", fmt.Sprintf("%s%s", ctx.ingestServer, ctx.streamName))
log.WithField("cmd", cmd.String()).Info("Starting premiere")
ffmpegErr, errFfmpegErrFile := os.OpenFile(fmt.Sprintf("%s/ffmpeg_%s.log", cfg.LogDir, ctx.getStreamName()), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0o644)
ffmpegErr, errFfmpegErrFile := os.OpenFile(fmt.Sprintf("%s/ffmpeg_%s.log", cfg.LogDir, ctx.getStreamName()), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)
if errFfmpegErrFile == nil {
cmd.Stderr = ffmpegErr
} else {
Expand Down
2 changes: 1 addition & 1 deletion worker/worker/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func stream(streamCtx *StreamContext) {
// persist stream command in context, so it can be killed later
streamCtx.streamCmd = cmd
log.WithField("cmd", cmd.String()).Info("Starting stream")
ffmpegErr, errFfmpegErrFile := os.OpenFile(fmt.Sprintf("%s/ffmpeg_%s.log", cfg.LogDir, streamCtx.getStreamName()), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0o644)
ffmpegErr, errFfmpegErrFile := os.OpenFile(fmt.Sprintf("%s/ffmpeg_%s.log", cfg.LogDir, streamCtx.getStreamName()), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)
if errFfmpegErrFile == nil {
cmd.Stderr = ffmpegErr
} else {
Expand Down
2 changes: 1 addition & 1 deletion worker/worker/thumbnails.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func createVideoThumbnail(ctx *StreamContext, source string) error {
if err != nil {
return err
}
file, err := os.OpenFile(ctx.getLargeThumbnailSpriteFileName(), os.O_CREATE|os.O_WRONLY, 0o644)
file, err := os.OpenFile(ctx.getLargeThumbnailSpriteFileName(), os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions worker/worker/transcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func handleTranscodingOutput(stderr io.ReadCloser, inputTime float64, progressCh
// creates folder for output file if it doesn't exist
func prepare(out string) error {
dir := filepath.Dir(out)
err := os.MkdirAll(dir, 0o750)
err := os.MkdirAll(dir, 0750)
if err != nil {
return fmt.Errorf("create output directory for transcoding: %s", err)
}
Expand All @@ -159,7 +159,7 @@ func prepare(out string) error {
// markForDeletion moves the file to $recfolder/.trash/
func markForDeletion(ctx *StreamContext) error {
trashName := ctx.getRecordingTrashName()
err := os.MkdirAll(filepath.Dir(trashName), 0o750)
err := os.MkdirAll(filepath.Dir(trashName), 0 750)
if err != nil {
return fmt.Errorf("create trash directory: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion worker/worker/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func createDummyFile(filesize uint) (string, error) {
if err != nil {
return "", err
}
f, err := os.OpenFile(file.Name(), os.O_APPEND|os.O_WRONLY, 0o600)
f, err := os.OpenFile(file.Name(), os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
return "", err
}
Expand Down

0 comments on commit 033666d

Please sign in to comment.