From 4708fb9371aebf100c37f57053ebd77d3471a53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 9 Apr 2022 17:03:01 +0200 Subject: [PATCH] rename module to full github path. (#53) --- cmd/neko_rooms/main.go | 8 ++++---- cmd/root.go | 21 +++++++++++++-------- cmd/serve.go | 18 +++++++++--------- go.mod | 2 +- internal/api/api.go | 4 ++-- internal/api/lobby.go | 2 +- internal/api/pull.go | 2 +- internal/api/rooms.go | 2 +- internal/http/manager.go | 4 ++-- internal/policies/chromium/generator.go | 3 ++- internal/policies/chromium/parser.go | 3 ++- internal/policies/config.go | 7 ++++--- internal/policies/firefox/generator.go | 3 ++- internal/policies/firefox/parser.go | 3 ++- internal/room/containers.go | 2 +- internal/room/labels.go | 2 +- internal/room/manager.go | 8 ++++---- internal/room/pull.go | 5 +++-- internal/types/room.go | 2 +- neko.go | 10 +++++----- 20 files changed, 61 insertions(+), 50 deletions(-) diff --git a/cmd/neko_rooms/main.go b/cmd/neko_rooms/main.go index dc90b26..30b108a 100644 --- a/cmd/neko_rooms/main.go +++ b/cmd/neko_rooms/main.go @@ -5,13 +5,13 @@ import ( "github.com/rs/zerolog/log" - "m1k1o/neko_rooms" - "m1k1o/neko_rooms/cmd" - "m1k1o/neko_rooms/internal/utils" + nekoRooms "github.com/m1k1o/neko-rooms" + "github.com/m1k1o/neko-rooms/cmd" + "github.com/m1k1o/neko-rooms/internal/utils" ) func main() { - fmt.Print(utils.Colorf(neko_rooms.Header, "server", neko_rooms.Service.Version)) + fmt.Print(utils.Colorf(nekoRooms.Header, "server", nekoRooms.Service.Version)) if err := cmd.Execute(); err != nil { log.Panic().Err(err).Msg("failed to execute command") } diff --git a/cmd/root.go b/cmd/root.go index 3dd7444..0e8e33c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -15,7 +15,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "m1k1o/neko_rooms" + nekoRooms "github.com/m1k1o/neko-rooms" ) func Execute() error { @@ -23,10 +23,10 @@ func Execute() error { } var root = &cobra.Command{ - Use: "neko_rooms", - Short: "neko_rooms server", - Long: `neko_rooms server`, - Version: neko_rooms.Service.Version.String(), + Use: "neko-rooms", + Short: "neko-rooms server", + Long: `neko-rooms server`, + Version: nekoRooms.Service.Version.String(), } func init() { @@ -49,6 +49,7 @@ func init() { logs := filepath.Join(".", "logs") if runtime.GOOS == "linux" { + // TODO: Change to neko-rooms. logs = "/var/log/neko_rooms" } @@ -56,9 +57,11 @@ func init() { os.Mkdir(logs, os.ModePerm) } + // TODO: Change to neko-rooms. latest := filepath.Join(logs, "neko_rooms-latest.log") _, err := os.Stat(latest) if err == nil { + // TODO: Change to neko-rooms. err = os.Rename(latest, filepath.Join(logs, "neko_rooms."+time.Now().Format("2006-01-02T15-04-05Z07-00")+".log")) if err != nil { log.Panic().Err(err).Msg("failed to rotate log file") @@ -85,10 +88,12 @@ func init() { viper.SetConfigFile(config) // Use config file from the flag. } else { if runtime.GOOS == "linux" { + // TODO: Change to neko-rooms. viper.AddConfigPath("/etc/neko_rooms/") } viper.AddConfigPath(".") + // TODO: Change to config. viper.SetConfigName("neko_rooms") } @@ -118,12 +123,12 @@ func init() { logger.Info().Msg("preflight complete") } - neko_rooms.Service.Configs.Root.Set() + nekoRooms.Service.Configs.Root.Set() }) - if err := neko_rooms.Service.Configs.Root.Init(root); err != nil { + if err := nekoRooms.Service.Configs.Root.Init(root); err != nil { log.Panic().Err(err).Msg("unable to run root command") } - root.SetVersionTemplate(neko_rooms.Service.Version.Details()) + root.SetVersionTemplate(nekoRooms.Service.Version.Details()) } diff --git a/cmd/serve.go b/cmd/serve.go index 36c0fe2..7a8b5b3 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -4,29 +4,29 @@ import ( "github.com/rs/zerolog/log" "github.com/spf13/cobra" - "m1k1o/neko_rooms" - "m1k1o/neko_rooms/internal/config" + nekoRooms "github.com/m1k1o/neko-rooms" + "github.com/m1k1o/neko-rooms/internal/config" ) func init() { command := &cobra.Command{ Use: "serve", - Short: "serve neko_rooms server", - Long: `serve neko_rooms server`, - Run: neko_rooms.Service.ServeCommand, + Short: "serve neko-rooms server", + Long: `serve neko-rooms server`, + Run: nekoRooms.Service.ServeCommand, } configs := []config.Config{ - neko_rooms.Service.Configs.Server, - neko_rooms.Service.Configs.API, - neko_rooms.Service.Configs.Room, + nekoRooms.Service.Configs.Server, + nekoRooms.Service.Configs.API, + nekoRooms.Service.Configs.Room, } cobra.OnInitialize(func() { for _, cfg := range configs { cfg.Set() } - neko_rooms.Service.Preflight() + nekoRooms.Service.Preflight() }) for _, cfg := range configs { diff --git a/go.mod b/go.mod index ff6fe64..2d635d9 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module m1k1o/neko_rooms +module github.com/m1k1o/neko-rooms go 1.17 diff --git a/internal/api/api.go b/internal/api/api.go index 783cde1..9cb5656 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -5,8 +5,8 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko_rooms/internal/config" - "m1k1o/neko_rooms/internal/types" + "github.com/m1k1o/neko-rooms/internal/config" + "github.com/m1k1o/neko-rooms/internal/types" ) type ApiManagerCtx struct { diff --git a/internal/api/lobby.go b/internal/api/lobby.go index f78e4e4..f7a4394 100644 --- a/internal/api/lobby.go +++ b/internal/api/lobby.go @@ -6,7 +6,7 @@ import ( "github.com/go-chi/chi" - "m1k1o/neko_rooms/internal/utils" + "github.com/m1k1o/neko-rooms/internal/utils" ) func (manager *ApiManagerCtx) RoomLobby(w http.ResponseWriter, r *http.Request) { diff --git a/internal/api/pull.go b/internal/api/pull.go index 800dcab..407fe0a 100644 --- a/internal/api/pull.go +++ b/internal/api/pull.go @@ -4,7 +4,7 @@ import ( "encoding/json" "net/http" - "m1k1o/neko_rooms/internal/types" + "github.com/m1k1o/neko-rooms/internal/types" ) func (manager *ApiManagerCtx) pullStart(w http.ResponseWriter, r *http.Request) { diff --git a/internal/api/rooms.go b/internal/api/rooms.go index b5f216c..bac2b84 100644 --- a/internal/api/rooms.go +++ b/internal/api/rooms.go @@ -6,7 +6,7 @@ import ( "github.com/go-chi/chi" - "m1k1o/neko_rooms/internal/types" + "github.com/m1k1o/neko-rooms/internal/types" ) func (manager *ApiManagerCtx) roomsList(w http.ResponseWriter, r *http.Request) { diff --git a/internal/http/manager.go b/internal/http/manager.go index 12a544f..a37d7f8 100644 --- a/internal/http/manager.go +++ b/internal/http/manager.go @@ -12,8 +12,8 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko_rooms/internal/config" - "m1k1o/neko_rooms/internal/types" + "github.com/m1k1o/neko-rooms/internal/config" + "github.com/m1k1o/neko-rooms/internal/types" ) type HttpManagerCtx struct { diff --git a/internal/policies/chromium/generator.go b/internal/policies/chromium/generator.go index b86b948..d4ed0a3 100644 --- a/internal/policies/chromium/generator.go +++ b/internal/policies/chromium/generator.go @@ -6,7 +6,8 @@ import ( _ "embed" "encoding/json" "fmt" - "m1k1o/neko_rooms/internal/types" + + "github.com/m1k1o/neko-rooms/internal/types" ) //go:embed policies.json diff --git a/internal/policies/chromium/parser.go b/internal/policies/chromium/parser.go index 2d18f14..76adc4d 100644 --- a/internal/policies/chromium/parser.go +++ b/internal/policies/chromium/parser.go @@ -4,8 +4,9 @@ package chromium import ( "encoding/json" - "m1k1o/neko_rooms/internal/types" "strings" + + "github.com/m1k1o/neko-rooms/internal/types" ) func Parse(policiesJson string) (*types.BrowserPolicyContent, error) { diff --git a/internal/policies/config.go b/internal/policies/config.go index e00436a..a8788d5 100644 --- a/internal/policies/config.go +++ b/internal/policies/config.go @@ -2,9 +2,10 @@ package policies import ( "errors" - "m1k1o/neko_rooms/internal/policies/chromium" - "m1k1o/neko_rooms/internal/policies/firefox" - "m1k1o/neko_rooms/internal/types" + + "github.com/m1k1o/neko-rooms/internal/policies/chromium" + "github.com/m1k1o/neko-rooms/internal/policies/firefox" + "github.com/m1k1o/neko-rooms/internal/types" ) func Generate(policies types.BrowserPolicyContent, policyType types.BrowserPolicyType) (string, error) { diff --git a/internal/policies/firefox/generator.go b/internal/policies/firefox/generator.go index 1946353..02bed06 100644 --- a/internal/policies/firefox/generator.go +++ b/internal/policies/firefox/generator.go @@ -5,7 +5,8 @@ package firefox import ( _ "embed" "encoding/json" - "m1k1o/neko_rooms/internal/types" + + "github.com/m1k1o/neko-rooms/internal/types" ) //go:embed policies.json diff --git a/internal/policies/firefox/parser.go b/internal/policies/firefox/parser.go index 8727352..a950764 100644 --- a/internal/policies/firefox/parser.go +++ b/internal/policies/firefox/parser.go @@ -5,7 +5,8 @@ package firefox import ( _ "embed" "encoding/json" - "m1k1o/neko_rooms/internal/types" + + "github.com/m1k1o/neko-rooms/internal/types" ) func Parse(policiesJson string) (*types.BrowserPolicyContent, error) { diff --git a/internal/room/containers.go b/internal/room/containers.go index aa0f869..6219e03 100644 --- a/internal/room/containers.go +++ b/internal/room/containers.go @@ -9,7 +9,7 @@ import ( dockerTypes "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" - "m1k1o/neko_rooms/internal/types" + "github.com/m1k1o/neko-rooms/internal/types" ) func (manager *RoomManagerCtx) containerToEntry(container dockerTypes.Container) (*types.RoomEntry, error) { diff --git a/internal/room/labels.go b/internal/room/labels.go index c384bc1..ae5b0c5 100644 --- a/internal/room/labels.go +++ b/internal/room/labels.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" - "m1k1o/neko_rooms/internal/types" + "github.com/m1k1o/neko-rooms/internal/types" ) type RoomLabels struct { diff --git a/internal/room/manager.go b/internal/room/manager.go index b97c6a2..d2f011a 100644 --- a/internal/room/manager.go +++ b/internal/room/manager.go @@ -20,10 +20,10 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko_rooms/internal/config" - "m1k1o/neko_rooms/internal/policies" - "m1k1o/neko_rooms/internal/types" - "m1k1o/neko_rooms/internal/utils" + "github.com/m1k1o/neko-rooms/internal/config" + "github.com/m1k1o/neko-rooms/internal/policies" + "github.com/m1k1o/neko-rooms/internal/types" + "github.com/m1k1o/neko-rooms/internal/utils" ) const ( diff --git a/internal/room/pull.go b/internal/room/pull.go index d7e60ff..a715e79 100644 --- a/internal/room/pull.go +++ b/internal/room/pull.go @@ -6,12 +6,13 @@ import ( "encoding/base64" "encoding/json" "fmt" - "m1k1o/neko_rooms/internal/types" - "m1k1o/neko_rooms/internal/utils" "sync" "time" dockerTypes "github.com/docker/docker/api/types" + + "github.com/m1k1o/neko-rooms/internal/types" + "github.com/m1k1o/neko-rooms/internal/utils" ) type PullConfig struct { diff --git a/internal/types/room.go b/internal/types/room.go index 61e132f..009616d 100644 --- a/internal/types/room.go +++ b/internal/types/room.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "m1k1o/neko_rooms/internal/utils" + "github.com/m1k1o/neko-rooms/internal/utils" ) var blacklistedEnvs = []string{ diff --git a/neko.go b/neko.go index cb18a0a..f7ca669 100644 --- a/neko.go +++ b/neko.go @@ -6,14 +6,14 @@ import ( "os/signal" "runtime" - "m1k1o/neko_rooms/internal/api" - "m1k1o/neko_rooms/internal/config" - "m1k1o/neko_rooms/internal/http" - "m1k1o/neko_rooms/internal/room" - "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/spf13/cobra" + + "github.com/m1k1o/neko-rooms/internal/api" + "github.com/m1k1o/neko-rooms/internal/config" + "github.com/m1k1o/neko-rooms/internal/http" + "github.com/m1k1o/neko-rooms/internal/room" ) const Header = `&34