Add fmt target to makefile and run it
This commit is contained in:
parent
a5757c3079
commit
7bdfcf9776
5
Makefile
5
Makefile
@ -12,6 +12,9 @@ debug:
|
||||
$(GO) build -o $(EXE) -gcflags=all="-N -l" cmd/$(EXE)/*.go
|
||||
dlv exec ./dischord
|
||||
|
||||
fmt:
|
||||
find . -type f -name '*.go' -exec gofmt -w '{}' ';'
|
||||
|
||||
install: all
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f $(EXE) $(DESTDIR)$(PREFIX)/bin
|
||||
@ -50,7 +53,7 @@ uninstall:
|
||||
test:
|
||||
$(GO) test -count=1 -v $(EXE)/extractor
|
||||
|
||||
.PHONY: all debug install uninstall clean
|
||||
.PHONY: all debug fmt install uninstall clean
|
||||
|
||||
clean:
|
||||
rm -f $(EXE)
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"git.nobrain.org/r4/dischord/player"
|
||||
"git.nobrain.org/r4/dischord/util"
|
||||
|
||||
_ "embed"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
@ -21,7 +22,6 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
var copyright bool
|
||||
@ -147,7 +147,7 @@ func main() {
|
||||
cfgfile := "config.toml"
|
||||
var cfg *config.Config
|
||||
var err error
|
||||
if autoconf || func() bool {cfg, err = config.Load(cfgfile); return err != nil}() {
|
||||
if autoconf || func() bool { cfg, err = config.Load(cfgfile); return err != nil }() {
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
fmt.Println("Configuration file not found, launching automatic configurator.")
|
||||
|
@ -125,7 +125,7 @@ func Autoconf(filename string) (*Config, error) {
|
||||
}
|
||||
|
||||
download := func(executable bool, urlsByOS map[string]map[string]string) (filename string, err error) {
|
||||
filename, err = download(executable, urlsByOS, func(progress float32){
|
||||
filename, err = download(executable, urlsByOS, func(progress float32) {
|
||||
fmt.Printf("Progress: %.1f%%\r", progress*100.0)
|
||||
})
|
||||
if err != nil {
|
||||
@ -163,7 +163,7 @@ func Autoconf(filename string) (*Config, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
youtubeDlPath = "./"+filename
|
||||
youtubeDlPath = "./" + filename
|
||||
macosEnableExecutable(youtubeDlPath)
|
||||
if python3IsPython {
|
||||
// Replace first line with `replacement`
|
||||
@ -220,7 +220,7 @@ func Autoconf(filename string) (*Config, error) {
|
||||
if err := os.Remove(filename); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cfg.FfmpegPath = "./"+targetFile
|
||||
cfg.FfmpegPath = "./" + targetFile
|
||||
macosEnableExecutable(cfg.FfmpegPath)
|
||||
} else {
|
||||
fmt.Println("Using FFmpeg executable found at", cfg.FfmpegPath)
|
||||
|
@ -85,7 +85,7 @@ func download(executable bool, urlsByOS map[string]map[string]string, progCallba
|
||||
}
|
||||
}
|
||||
if progCallback != nil && size != 0 {
|
||||
progCallback(float32(i)/float32(size))
|
||||
progCallback(float32(i) / float32(size))
|
||||
}
|
||||
}
|
||||
return savePath, nil
|
||||
|
@ -151,7 +151,7 @@ func (e *ConfigTypeError) Error() string {
|
||||
if e.Got != nil {
|
||||
gotName = e.Got.Name()
|
||||
}
|
||||
return "extractor config type error: "+e.Provider+"."+e.Key+": expected "+expectedName+" but got "+gotName
|
||||
return "extractor config type error: " + e.Provider + "." + e.Key + ": expected " + expectedName + " but got " + gotName
|
||||
}
|
||||
|
||||
type ProviderConfig map[string]any
|
||||
|
Loading…
Reference in New Issue
Block a user