diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e2c1527..1ff5171b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,11 +43,11 @@ jobs: # matrix build jobs run on every commit # building on versioned Go and the latest one # '<<: *' syntax is a YAML thing for including documents - "golang:1.12": + "golang:1.17": <<: *env-shared <<: *build-shared docker: - - image: circleci/golang:1.12 + - image: circleci/golang:1.17 "golang:latest": <<: *env-shared <<: *build-shared @@ -57,7 +57,7 @@ jobs: release: <<: *env-shared docker: - - image: circleci/golang:1.12 + - image: circleci/golang:1.17 steps: - checkout #- run: @@ -88,7 +88,7 @@ workflows: build: jobs: # build matrix - - "golang:1.12" + - "golang:1.17" - "golang:latest" release: jobs: diff --git a/docs/Config.md b/docs/Config.md index 5bd753dc..6e4f9d95 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -27,7 +27,6 @@ gui: - blue returnImmediately: false wrapMainPanel: false -reporting: undetermined commandTemplates: dockerCompose: docker-compose restartService: '{{ .DockerCompose }} restart {{ .Service.Name }}' diff --git a/pkg/commands/os_default_platform.go b/pkg/commands/os_default_platform.go index 067bb5e6..7d289796 100644 --- a/pkg/commands/os_default_platform.go +++ b/pkg/commands/os_default_platform.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package commands diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 00f62208..0ede0554 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -29,12 +29,6 @@ type UserConfig struct { // hide things Gui GuiConfig `yaml:"gui,omitempty"` - // Reporting determines whether events are reported such as errors (and maybe - // application opens but I'm not decided on that yet because it sounds kinda - // creepy but I also would love to know how many people are using this - // program) - Reporting string `yaml:"reporting,omitempty"` - // ConfirmOnQuit when enabled prompts you to confirm you want to quit when you // hit esc or q when no confirmation panels are open ConfirmOnQuit bool `yaml:"confirmOnQuit,omitempty"` @@ -326,7 +320,6 @@ func GetDefaultConfig() UserConfig { ReturnImmediately: false, WrapMainPanel: false, }, - Reporting: "undetermined", ConfirmOnQuit: false, CommandTemplates: CommandTemplatesConfig{ DockerCompose: "docker-compose", diff --git a/pkg/config/app_config_test.go b/pkg/config/app_config_test.go index 4553920a..71ce90c3 100644 --- a/pkg/config/app_config_test.go +++ b/pkg/config/app_config_test.go @@ -60,9 +60,9 @@ func TestWritingToConfigFile(t *testing.T) { t.Fatalf("Unexpected error: %s", err) } - testFn := func(ac *AppConfig, newReportingValue string, t *testing.T) { + testFn := func(ac *AppConfig, newValue bool, t *testing.T) { updateFn := func(uc *UserConfig) error { - uc.Reporting = newReportingValue + uc.ConfirmOnQuit = newValue return nil } @@ -87,14 +87,14 @@ func TestWritingToConfigFile(t *testing.T) { t.Fatalf("Unexpected error: %s", err) } - if sampleUC.Reporting != newReportingValue { - t.Fatalf("Got %s, Expected %s\n", sampleUC.Reporting, newReportingValue) + if sampleUC.ConfirmOnQuit != newValue { + t.Fatalf("Got %v, Expected %v\n", sampleUC.ConfirmOnQuit, newValue) } } // insert value into an empty file - testFn(conf, "on", t) + testFn(conf, true, t) - // modifying an existing file that already has 'Reporting' - testFn(conf, "off", t) + // modifying an existing file that already has 'ConfirmOnQuit' + testFn(conf, false, t) } diff --git a/pkg/config/config_default_platform.go b/pkg/config/config_default_platform.go index e9e2f63b..fd1defdc 100644 --- a/pkg/config/config_default_platform.go +++ b/pkg/config/config_default_platform.go @@ -1,3 +1,4 @@ +//go:build !windows && !linux // +build !windows,!linux package config diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index c0bd26e7..b2085f17 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -8,7 +8,6 @@ package gui import ( "strings" - "time" "github.com/fatih/color" "github.com/jesseduffield/gocui" @@ -151,16 +150,6 @@ func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*go // this function is to be used over the more generic createErrorPanel, with // willLog set to false func (gui *Gui) createSpecificErrorPanel(message string, nextView *gocui.View, willLog bool) error { - if willLog { - go func() { - // when reporting is switched on this log call sometimes introduces - // a delay on the error panel popping up. Here I'm adding a second wait - // so that the error is logged while the user is reading the error message - time.Sleep(time.Second) - gui.Log.Error(message) - }() - } - colorFunction := color.New(color.FgRed).SprintFunc() coloredMessage := colorFunction(strings.TrimSpace(message)) return gui.createConfirmationPanel(gui.g, nextView, gui.Tr.ErrorTitle, coloredMessage, nil, nil) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index db171219..fad2864d 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -1,10 +1,11 @@ package gui import ( - "github.com/golang-collections/collections/stack" "strings" "sync" + "github.com/golang-collections/collections/stack" + // "io" // "io/ioutil" @@ -187,33 +188,9 @@ func (gui *Gui) loadNewDirectory() error { return err } - if gui.Config.UserConfig.Reporting == "undetermined" { - if err := gui.promptAnonymousReporting(); err != nil { - return err - } - } return nil } -func (gui *Gui) promptAnonymousReporting() error { - return gui.createConfirmationPanel(gui.g, nil, gui.Tr.AnonymousReportingTitle, gui.Tr.AnonymousReportingPrompt, func(g *gocui.Gui, v *gocui.View) error { - gui.waitForIntro.Done() - // setting the value here explicitly so that we don't re-request after coming back from a subprocess. The proper solution would be to reload the config but that's tricky because it's loaded at the very top level - gui.Config.UserConfig.Reporting = "on" - return gui.Config.WriteToUserConfig(func(userConfig *config.UserConfig) error { - userConfig.Reporting = "on" - return nil - }) - }, func(g *gocui.Gui, v *gocui.View) error { - gui.waitForIntro.Done() - gui.Config.UserConfig.Reporting = "off" - return gui.Config.WriteToUserConfig(func(userConfig *config.UserConfig) error { - userConfig.Reporting = "off" - return nil - }) - }) -} - func (gui *Gui) renderGlobalOptions() error { return gui.renderOptionsMap(map[string]string{ "PgUp/PgDn": gui.Tr.Scroll, @@ -261,11 +238,7 @@ func (gui *Gui) Run() error { return err } - if gui.Config.UserConfig.Reporting == "undetermined" { - gui.waitForIntro.Add(2) - } else { - gui.waitForIntro.Add(1) - } + gui.waitForIntro.Add(1) dockerRefreshInterval := gui.Config.UserConfig.Update.DockerRefreshInterval go func() { diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index 43984433..e455567e 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -52,9 +52,6 @@ func dutchSet() TranslationSet { ViewRestartOptions: "bekijk herstart opties", RunCustomCommand: "draai een vooraf bedacht aangepaste opdracht", - AnonymousReportingTitle: "Help mee met lazydocker beter maken", - AnonymousReportingPrompt: "Zou je anonieme data rapportage willen aanzetten om lazydocker beter te kunnen maken?", - GlobalTitle: "Globaal", MainTitle: "Hoofd", ProjectTitle: "Project", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 81aaf0c9..8efb854e 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -16,8 +16,6 @@ type TranslationSet struct { NoViewMachingNewLineFocusedSwitchStatement string OpenConfig string EditConfig string - AnonymousReportingTitle string - AnonymousReportingPrompt string ConfirmQuit string ErrorOccurred string ConnectionFailed string @@ -155,9 +153,6 @@ func englishSet() TranslationSet { ViewBulkCommands: "view bulk commands", OpenInBrowser: "open in browser (first port is http)", - AnonymousReportingTitle: "Help make lazydocker better", - AnonymousReportingPrompt: "Would you like to enable anonymous reporting data to help improve lazydocker?", - GlobalTitle: "Global", MainTitle: "Main", ProjectTitle: "Project", diff --git a/pkg/i18n/german.go b/pkg/i18n/german.go index f127a654..2c5a816e 100644 --- a/pkg/i18n/german.go +++ b/pkg/i18n/german.go @@ -51,9 +51,6 @@ func germanSet() TranslationSet { ViewRestartOptions: "zeige Neustartoptionen", RunCustomCommand: "führe vordefinierten benutzerdefinierten Befehl aus", - AnonymousReportingTitle: "Mache dabei mit lazydocker besser zu machen", - AnonymousReportingPrompt: "Möchtest du anonymisierte Datensammlung erlauben, um dabei zu helfen lazydocker zu verbessern?", - GlobalTitle: "Global", MainTitle: "Haupt", ProjectTitle: "Projekt", diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index b2d46fc0..53681fa4 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -51,9 +51,6 @@ func polishSet() TranslationSet { ViewRestartOptions: "pokaż opcje restartu", RunCustomCommand: "wykonaj predefiniowaną własną komende", - AnonymousReportingTitle: "Pomóż czynić lazydocker lepszym", - AnonymousReportingPrompt: "Czy zechciałbyś włączyć anonimowe raportowanie danych w celu ulepszania programu?", - GlobalTitle: "Globalne", MainTitle: "Główne", ProjectTitle: "Projekt", diff --git a/pkg/i18n/turkish.go b/pkg/i18n/turkish.go index 24dbd6be..a728dabf 100644 --- a/pkg/i18n/turkish.go +++ b/pkg/i18n/turkish.go @@ -51,9 +51,6 @@ func turkishSet() TranslationSet { ViewRestartOptions: "yeniden başlatma seçeneklerini görüntüle", RunCustomCommand: "önceden tanımlanmış özel komutu çalıştır", - AnonymousReportingTitle: "lazydocker' ı daha iyi hale getirmeye yardımcı olun", - AnonymousReportingPrompt: "lazydocker'ın geliştirilmesine yardımcı olmak için anonim raporlama verilerini etkinleştirmek ister misiniz?", - GlobalTitle: "Global", MainTitle: "Ana", ProjectTitle: "Proje",