From 832387f663dece63d095fc900ba8bae9a158046a Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 22 Jul 2023 23:17:45 +0400 Subject: [PATCH] A little refactoring in main.go. --- cmd/dwelling-radio/main.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/dwelling-radio/main.go b/cmd/dwelling-radio/main.go index 56ae549..7f38df4 100644 --- a/cmd/dwelling-radio/main.go +++ b/cmd/dwelling-radio/main.go @@ -2,14 +2,14 @@ package main import ( "dwelling-radio/internal/configuration" - "dwelling-radio/internal/http" + ihttp "dwelling-radio/internal/http" "dwelling-radio/internal/radio" "dwelling-radio/web" "flag" "fmt" "io/fs" "log" - nethttp "net/http" + "net/http" "os" "os/signal" "syscall" @@ -51,24 +51,24 @@ func main() { } defer playlistWatcher.Close() - hand := http.NewHandlers(config) + hand := ihttp.NewHandlers(config) r := httpr.New() - r.Handler(nethttp.MethodGet, "/", hand.Index) + r.Handler(http.MethodGet, "/", hand.Index) - r.Handler(nethttp.MethodGet, "/status", hand.Status) - r.Handler(nethttp.MethodGet, "/lastsong", hand.LastSong) + r.Handler(http.MethodGet, "/status", hand.Status) + r.Handler(http.MethodGet, "/lastsong", hand.LastSong) - r.Handler(nethttp.MethodGet, "/playlist", hand.Playlist) - r.Handler(nethttp.MethodGet, "/filelist", hand.Filelist) + r.Handler(http.MethodGet, "/playlist", hand.Playlist) + r.Handler(http.MethodGet, "/filelist", hand.Filelist) - r.Handler(nethttp.MethodGet, "/robots.txt", http.RobotsTxt) - r.Handler(nethttp.MethodGet, "/sitemap.xml", http.SitemapXML) - r.Handler(nethttp.MethodGet, "/favicon.svg", http.Favicon) + r.Handler(http.MethodGet, "/robots.txt", ihttp.RobotsTxt) + r.Handler(http.MethodGet, "/sitemap.xml", ihttp.SitemapXML) + r.Handler(http.MethodGet, "/favicon.svg", ihttp.Favicon) r.ServeStatic("/assets/*filepath", web.Assets()) - srv := http.NewHttpServer(r) + srv := ihttp.NewHttpServer(r) if err := srv.Start(config.SplitNetworkAddress()); err != nil { log.Fatalln(err)