From 6bc57b7628f3d699b377b8afd5c05d4f3a4d4730 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 9 May 2022 21:31:24 +1000 Subject: [PATCH] appease linter --- pkg/commands/container.go | 16 ++++++---------- pkg/commands/container_stats.go | 8 +++----- pkg/commands/docker.go | 8 ++++---- pkg/commands/image.go | 5 ++--- pkg/commands/os.go | 3 +-- pkg/commands/os_test.go | 2 +- pkg/commands/service.go | 1 - pkg/commands/sort_container_test.go | 4 +++- pkg/config/app_config_test.go | 14 ++++++-------- pkg/gui/confirmation_panel.go | 6 ++++-- pkg/gui/containers_panel.go | 20 ++++++++++---------- pkg/gui/images_panel.go | 6 +++--- pkg/gui/layout.go | 2 +- pkg/gui/options_menu_panel.go | 4 +--- pkg/gui/project_panel.go | 14 +++++++------- pkg/gui/services_panel.go | 8 ++++---- pkg/gui/view_helpers.go | 4 ++-- pkg/gui/volumes_panel.go | 6 +++--- pkg/log/log.go | 2 +- pkg/utils/utils.go | 2 +- pkg/utils/utils_test.go | 2 +- scripts/generate_cheatsheet.go | 9 --------- 22 files changed, 64 insertions(+), 82 deletions(-) diff --git a/pkg/commands/container.go b/pkg/commands/container.go index ad9f95a3..6374581d 100644 --- a/pkg/commands/container.go +++ b/pkg/commands/container.go @@ -83,13 +83,11 @@ type Details struct { Binds []string `json:"Binds"` ContainerIDFile string `json:"ContainerIDFile"` LogConfig struct { - Type string `json:"Type"` - Config struct { - } `json:"Config"` + Type string `json:"Type"` + Config struct{} `json:"Config"` } `json:"LogConfig"` - NetworkMode string `json:"NetworkMode"` - PortBindings struct { - } `json:"PortBindings"` + NetworkMode string `json:"NetworkMode"` + PortBindings struct{} `json:"PortBindings"` RestartPolicy struct { Name string `json:"Name"` MaximumRetryCount int `json:"MaximumRetryCount"` @@ -185,10 +183,8 @@ type Details struct { Cmd []string `json:"Cmd"` Image string `json:"Image"` Volumes struct { - APIBundle struct { - } `json:"/api-bundle"` - App struct { - } `json:"/app"` + APIBundle struct{} `json:"/api-bundle"` + App struct{} `json:"/app"` } `json:"Volumes"` WorkingDir string `json:"WorkingDir"` Entrypoint interface{} `json:"Entrypoint"` diff --git a/pkg/commands/container_stats.go b/pkg/commands/container_stats.go index b491d56a..34817a4d 100644 --- a/pkg/commands/container_stats.go +++ b/pkg/commands/container_stats.go @@ -56,10 +56,9 @@ type ContainerStats struct { IoTimeRecursive []interface{} `json:"io_time_recursive"` SectorsRecursive []interface{} `json:"sectors_recursive"` } `json:"blkio_stats"` - NumProcs int `json:"num_procs"` - StorageStats struct { - } `json:"storage_stats"` - CPUStats struct { + NumProcs int `json:"num_procs"` + StorageStats struct{} `json:"storage_stats"` + CPUStats struct { CPUUsage struct { TotalUsage int64 `json:"total_usage"` PercpuUsage []int64 `json:"percpu_usage"` @@ -161,7 +160,6 @@ func (s *ContainerStats) CalculateContainerCPUPercentage() float64 { // CalculateContainerMemoryUsage calculates the memory usage of the container as a percent of total available memory func (s *ContainerStats) CalculateContainerMemoryUsage() float64 { - value := float64(s.MemoryStats.Usage*100) / float64(s.MemoryStats.Limit) if math.IsNaN(value) { return 0 diff --git a/pkg/commands/docker.go b/pkg/commands/docker.go index 95117cfc..a44ba65a 100644 --- a/pkg/commands/docker.go +++ b/pkg/commands/docker.go @@ -68,7 +68,7 @@ type CommandObject struct { // NewCommandObject takes a command object and returns a default command object with the passed command object merged in func (c *DockerCommand) NewCommandObject(obj CommandObject) CommandObject { defaultObj := CommandObject{DockerCompose: c.Config.UserConfig.CommandTemplates.DockerCompose} - mergo.Merge(&defaultObj, obj) + _ = mergo.Merge(&defaultObj, obj) return defaultObj } @@ -139,7 +139,7 @@ func (c *DockerCommand) MonitorCLIContainerStats() { return } - cmd.Start() + _ = cmd.Start() scanner := bufio.NewScanner(r) scanner.Split(bufio.ScanLines) @@ -160,7 +160,7 @@ func (c *DockerCommand) MonitorCLIContainerStats() { c.ContainerMutex.Unlock() } - cmd.Wait() + _ = cmd.Wait() } // MonitorClientContainerStats is a function @@ -192,7 +192,7 @@ func (c *DockerCommand) createClientStatMonitor(container *Container) { for scanner.Scan() { data := scanner.Bytes() var stats ContainerStats - json.Unmarshal(data, &stats) + _ = json.Unmarshal(data, &stats) recordedStats := RecordedStats{ ClientStats: stats, diff --git a/pkg/commands/image.go b/pkg/commands/image.go index fb8cee76..bd5297fb 100644 --- a/pkg/commands/image.go +++ b/pkg/commands/image.go @@ -2,9 +2,10 @@ package commands import ( "context" - "github.com/docker/docker/api/types/image" "strings" + "github.com/docker/docker/api/types/image" + "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" @@ -27,7 +28,6 @@ type Image struct { // GetDisplayStrings returns the display string of Image func (i *Image) GetDisplayStrings(isFocused bool) []string { - return []string{i.Name, i.Tag, utils.FormatDecimalBytes(int(i.Image.Size))} } @@ -87,7 +87,6 @@ func (l *Layer) GetDisplayStrings(isFocused bool) []string { // RenderHistory renders the history of the image func (i *Image) RenderHistory() (string, error) { - history, err := i.Client.ImageHistory(context.Background(), i.ID) if err != nil { return "", err diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 5dee9b36..e313e276 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -190,7 +190,7 @@ func (c *OSCommand) Unquote(message string) string { // AppendLineToFile adds a new line in file func (c *OSCommand) AppendLineToFile(filename, line string) error { - f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) + f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0o600) if err != nil { return WrapError(err) } @@ -272,7 +272,6 @@ func (c *OSCommand) RunCustomCommand(command string) *exec.Cmd { // PipeCommands runs a heap of commands and pipes their inputs/outputs together like A | B | C func (c *OSCommand) PipeCommands(commandStrings ...string) error { - cmds := make([]*exec.Cmd, len(commandStrings)) for i, str := range commandStrings { diff --git a/pkg/commands/os_test.go b/pkg/commands/os_test.go index c54d0522..fb8c475b 100644 --- a/pkg/commands/os_test.go +++ b/pkg/commands/os_test.go @@ -235,7 +235,7 @@ func TestOSCommandFileType(t *testing.T) { { "testDirectory", func() { - if err := os.Mkdir("testDirectory", 0644); err != nil { + if err := os.Mkdir("testDirectory", 0o644); err != nil { panic(err) } }, diff --git a/pkg/commands/service.go b/pkg/commands/service.go index a0642cb0..ca8af1db 100644 --- a/pkg/commands/service.go +++ b/pkg/commands/service.go @@ -23,7 +23,6 @@ type Service struct { // GetDisplayStrings returns the dispaly string of Container func (s *Service) GetDisplayStrings(isFocused bool) []string { - if s.Container == nil { return []string{utils.ColoredString("none", color.FgBlue), "", s.Name, ""} } diff --git a/pkg/commands/sort_container_test.go b/pkg/commands/sort_container_test.go index 5a8cb2a1..19576650 100644 --- a/pkg/commands/sort_container_test.go +++ b/pkg/commands/sort_container_test.go @@ -1,10 +1,11 @@ package commands import ( + "testing" + "github.com/docker/docker/api/types" "github.com/jesseduffield/lazydocker/pkg/config" "github.com/stretchr/testify/assert" - "testing" ) func sampleContainers(userConfig *config.AppConfig) []*Container { @@ -119,6 +120,7 @@ func expectedLegacySortedContainers(appConfig *config.AppConfig) []*Container { } func assertEqualContainers(t *testing.T, left *Container, right *Container) { + t.Helper() assert.Equal(t, left.Container.State, right.Container.State) assert.Equal(t, left.Container.ID, right.Container.ID) assert.Equal(t, left.Name, right.Name) diff --git a/pkg/config/app_config_test.go b/pkg/config/app_config_test.go index 71ce90c3..1aa05db6 100644 --- a/pkg/config/app_config_test.go +++ b/pkg/config/app_config_test.go @@ -10,7 +10,6 @@ import ( func TestDockerComposeCommandNoFiles(t *testing.T) { composeFiles := []string{} conf, err := NewAppConfig("name", "version", "commit", "date", "buildSource", false, composeFiles, "projectDir") - if err != nil { t.Fatalf("Unexpected error: %s", err) } @@ -25,7 +24,6 @@ func TestDockerComposeCommandNoFiles(t *testing.T) { func TestDockerComposeCommandSingleFile(t *testing.T) { composeFiles := []string{"one.yml"} conf, err := NewAppConfig("name", "version", "commit", "date", "buildSource", false, composeFiles, "projectDir") - if err != nil { t.Fatalf("Unexpected error: %s", err) } @@ -40,7 +38,6 @@ func TestDockerComposeCommandSingleFile(t *testing.T) { func TestDockerComposeCommandMultipleFiles(t *testing.T) { composeFiles := []string{"one.yml", "two.yml", "three.yml"} conf, err := NewAppConfig("name", "version", "commit", "date", "buildSource", false, composeFiles, "projectDir") - if err != nil { t.Fatalf("Unexpected error: %s", err) } @@ -53,14 +50,15 @@ func TestDockerComposeCommandMultipleFiles(t *testing.T) { } func TestWritingToConfigFile(t *testing.T) { - //init the AppConfig + // init the AppConfig emptyComposeFiles := []string{} conf, err := NewAppConfig("name", "version", "commit", "date", "buildSource", false, emptyComposeFiles, "projectDir") if err != nil { t.Fatalf("Unexpected error: %s", err) } - testFn := func(ac *AppConfig, newValue bool, t *testing.T) { + testFn := func(t *testing.T, ac *AppConfig, newValue bool) { + t.Helper() updateFn := func(uc *UserConfig) error { uc.ConfirmOnQuit = newValue return nil @@ -71,7 +69,7 @@ func TestWritingToConfigFile(t *testing.T) { t.Fatalf("Unexpected error: %s", err) } - file, err := os.OpenFile(ac.ConfigFilename(), os.O_RDONLY, 0660) + file, err := os.OpenFile(ac.ConfigFilename(), os.O_RDONLY, 0o660) if err != nil { t.Fatalf("Unexpected error: %s", err) } @@ -93,8 +91,8 @@ func TestWritingToConfigFile(t *testing.T) { } // insert value into an empty file - testFn(conf, true, t) + testFn(t, conf, true) // modifying an existing file that already has 'ConfirmOnQuit' - testFn(conf, false, t) + testFn(t, conf, false) } diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index b2085f17..a110a818 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -90,9 +90,11 @@ func (gui *Gui) prepareConfirmationPanel(currentView *gocui.View, title, prompt } func (gui *Gui) onNewPopupPanel() { - viewNames := []string{"commitMessage", + viewNames := []string{ + "commitMessage", "credentials", - "menu"} + "menu", + } for _, viewName := range viewNames { _, _ = gui.g.SetViewOnBottom(viewName) } diff --git a/pkg/gui/containers_panel.go b/pkg/gui/containers_panel.go index 85a332dc..821c0c19 100644 --- a/pkg/gui/containers_panel.go +++ b/pkg/gui/containers_panel.go @@ -120,7 +120,7 @@ func (gui *Gui) renderContainerEnv(container *commands.Container) error { } } return gui.T.NewTask(func(stop chan struct{}) { - gui.renderString(gui.g, "main", renderedTable) + _ = gui.renderString(gui.g, "main", renderedTable) }) } @@ -170,7 +170,7 @@ func (gui *Gui) renderContainerConfig(container *commands.Container) error { output += fmt.Sprintf("\nFull details:\n\n%s", string(data)) return gui.T.NewTask(func(stop chan struct{}) { - gui.renderString(gui.g, "main", output) + _ = gui.renderString(gui.g, "main", output) }) } @@ -184,10 +184,10 @@ func (gui *Gui) renderContainerStats(container *commands.Container) error { contents, err := container.RenderStats(width) if err != nil { - gui.createErrorPanel(gui.g, err.Error()) + _ = gui.createErrorPanel(gui.g, err.Error()) } - gui.reRenderString(gui.g, "main", contents) + _ = gui.reRenderString(gui.g, "main", contents) }) } @@ -199,10 +199,10 @@ func (gui *Gui) renderContainerTop(container *commands.Container) error { return gui.T.NewTickerTask(time.Second, func(stop chan struct{}) { gui.clearMainView() }, func(stop, notifyStopped chan struct{}) { contents, err := container.RenderTop() if err != nil { - gui.reRenderString(gui.g, "main", err.Error()) + _ = gui.reRenderString(gui.g, "main", err.Error()) } - gui.reRenderString(gui.g, "main", contents) + _ = gui.reRenderString(gui.g, "main", contents) }) } @@ -234,7 +234,7 @@ func (gui *Gui) renderContainerLogsAux(container *commands.Container, stop, noti cmd.Stdout = mainView cmd.Stderr = mainView - cmd.Start() + _ = cmd.Start() go func() { <-stop @@ -245,7 +245,7 @@ func (gui *Gui) renderContainerLogsAux(container *commands.Container, stop, noti return }() - cmd.Wait() + _ = cmd.Wait() // if we are here because the task has been stopped, we should return // if we are here then the container must have exited, meaning we should wait until it's back again before @@ -389,7 +389,7 @@ func (gui *Gui) handleContainersNextContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Containers.ContextIndex++ } - gui.handleContainerSelect(gui.g, v) + _ = gui.handleContainerSelect(gui.g, v) return nil } @@ -402,7 +402,7 @@ func (gui *Gui) handleContainersPrevContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Containers.ContextIndex-- } - gui.handleContainerSelect(gui.g, v) + _ = gui.handleContainerSelect(gui.g, v) return nil } diff --git a/pkg/gui/images_panel.go b/pkg/gui/images_panel.go index 8a89e972..561faef0 100644 --- a/pkg/gui/images_panel.go +++ b/pkg/gui/images_panel.go @@ -93,7 +93,7 @@ func (gui *Gui) renderImageConfig(mainView *gocui.View, image *commands.Image) e mainView.Autoscroll = false mainView.Wrap = false // don't care what your config is this page is ugly without wrapping - gui.renderString(gui.g, "main", output) + _ = gui.renderString(gui.g, "main", output) }) } @@ -174,7 +174,7 @@ func (gui *Gui) handleImagesNextContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Images.ContextIndex++ } - gui.handleImageSelect(gui.g, v) + _ = gui.handleImageSelect(gui.g, v) return nil } @@ -187,7 +187,7 @@ func (gui *Gui) handleImagesPrevContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Images.ContextIndex-- } - gui.handleImageSelect(gui.g, v) + _ = gui.handleImageSelect(gui.g, v) return nil } diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index e727a03a..0d97245c 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -152,7 +152,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { } _, _ = g.SetViewOnBottom("limit") - g.DeleteView("limit") + _ = g.DeleteView("limit") v, err := g.SetView("main", leftSideWidth+1, 0, width-1, height-2, gocui.LEFT) if err != nil { diff --git a/pkg/gui/options_menu_panel.go b/pkg/gui/options_menu_panel.go index 5a548187..d1220d81 100644 --- a/pkg/gui/options_menu_panel.go +++ b/pkg/gui/options_menu_panel.go @@ -9,9 +9,7 @@ import ( ) func (gui *Gui) getBindings(v *gocui.View) []*Binding { - var ( - bindingsGlobal, bindingsPanel []*Binding - ) + var bindingsGlobal, bindingsPanel []*Binding bindings := gui.GetInitialKeybindings() diff --git a/pkg/gui/project_panel.go b/pkg/gui/project_panel.go index ef4da837..2e3d7b5c 100644 --- a/pkg/gui/project_panel.go +++ b/pkg/gui/project_panel.go @@ -108,7 +108,7 @@ func (gui *Gui) renderCredits() error { mainView.Wrap = gui.Config.UserConfig.Gui.WrapMainPanel var configBuf bytes.Buffer - yaml.NewEncoder(&configBuf, yaml.IncludeOmitted).Encode(gui.Config.UserConfig) + _ = yaml.NewEncoder(&configBuf, yaml.IncludeOmitted).Encode(gui.Config.UserConfig) dashboardString := strings.Join( []string{ @@ -122,7 +122,7 @@ func (gui *Gui) renderCredits() error { configBuf.String(), }, "\n\n") - gui.renderString(gui.g, "main", dashboardString) + _ = gui.renderString(gui.g, "main", dashboardString) }) } @@ -145,7 +145,7 @@ func (gui *Gui) renderAllLogs() error { cmd.Stderr = mainView gui.OSCommand.PrepareForChildren(cmd) - cmd.Start() + _ = cmd.Start() go func() { <-stop @@ -154,7 +154,7 @@ func (gui *Gui) renderAllLogs() error { } }() - cmd.Wait() + _ = cmd.Wait() }) } @@ -165,7 +165,7 @@ func (gui *Gui) renderDockerComposeConfig() error { mainView.Wrap = gui.Config.UserConfig.Gui.WrapMainPanel config := gui.DockerCommand.DockerComposeConfig() - gui.renderString(gui.g, "main", config) + _ = gui.renderString(gui.g, "main", config) }) } @@ -198,7 +198,7 @@ func (gui *Gui) handleProjectNextContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Project.ContextIndex++ } - gui.handleProjectSelect(gui.g, v) + _ = gui.handleProjectSelect(gui.g, v) return nil } @@ -211,7 +211,7 @@ func (gui *Gui) handleProjectPrevContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Project.ContextIndex-- } - gui.handleProjectSelect(gui.g, v) + _ = gui.handleProjectSelect(gui.g, v) return nil } diff --git a/pkg/gui/services_panel.go b/pkg/gui/services_panel.go index f80d8493..87b72cc5 100644 --- a/pkg/gui/services_panel.go +++ b/pkg/gui/services_panel.go @@ -118,10 +118,10 @@ func (gui *Gui) renderServiceTop(service *commands.Service) error { return gui.T.NewTickerTask(time.Second, func(stop chan struct{}) { gui.clearMainView() }, func(stop, notifyStopped chan struct{}) { contents, err := service.RenderTop() if err != nil { - gui.reRenderString(gui.g, "main", err.Error()) + _ = gui.reRenderString(gui.g, "main", err.Error()) } - gui.reRenderString(gui.g, "main", contents) + _ = gui.reRenderString(gui.g, "main", contents) }) } @@ -170,7 +170,7 @@ func (gui *Gui) handleServicesNextContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Services.ContextIndex++ } - gui.handleServiceSelect(gui.g, v) + _ = gui.handleServiceSelect(gui.g, v) return nil } @@ -183,7 +183,7 @@ func (gui *Gui) handleServicesPrevContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Services.ContextIndex-- } - gui.handleServiceSelect(gui.g, v) + _ = gui.handleServiceSelect(gui.g, v) return nil } diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 0a241b58..edc6398a 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -354,8 +354,8 @@ func (gui *Gui) popupPanelFocused() bool { func (gui *Gui) clearMainView() { mainView := gui.getMainView() mainView.Clear() - mainView.SetOrigin(0, 0) - mainView.SetCursor(0, 0) + _ = mainView.SetOrigin(0, 0) + _ = mainView.SetCursor(0, 0) } func (gui *Gui) handleClick(v *gocui.View, itemCount int, selectedLine *int, handleSelect func(*gocui.Gui, *gocui.View) error) error { diff --git a/pkg/gui/volumes_panel.go b/pkg/gui/volumes_panel.go index ebcac4ff..0ea4f735 100644 --- a/pkg/gui/volumes_panel.go +++ b/pkg/gui/volumes_panel.go @@ -99,7 +99,7 @@ func (gui *Gui) renderVolumeConfig(mainView *gocui.View, volume *commands.Volume output += utils.WithPadding("Size: ", padding) + utils.FormatBinaryBytes(int(volume.Volume.UsageData.Size)) + "\n" } - gui.renderString(gui.g, "main", output) + _ = gui.renderString(gui.g, "main", output) }) } @@ -168,7 +168,7 @@ func (gui *Gui) handleVolumesNextContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Volumes.ContextIndex++ } - gui.handleVolumeSelect(gui.g, v) + _ = gui.handleVolumeSelect(gui.g, v) return nil } @@ -181,7 +181,7 @@ func (gui *Gui) handleVolumesPrevContext(g *gocui.Gui, v *gocui.View) error { gui.State.Panels.Volumes.ContextIndex-- } - gui.handleVolumeSelect(gui.g, v) + _ = gui.handleVolumeSelect(gui.g, v) return nil } diff --git a/pkg/log/log.go b/pkg/log/log.go index a4022532..e80cadc7 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -43,7 +43,7 @@ func getLogLevel() logrus.Level { func newDevelopmentLogger(config *config.AppConfig) *logrus.Logger { log := logrus.New() log.SetLevel(getLogLevel()) - file, err := os.OpenFile(filepath.Join(config.ConfigDir, "development.log"), os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) + file, err := os.OpenFile(filepath.Join(config.ConfigDir, "development.log"), os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o666) if err != nil { fmt.Println("unable to log to file") os.Exit(1) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index de6ec340..828195da 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -269,7 +269,7 @@ func FormatDecimalBytes(b int) string { func ApplyTemplate(str string, object interface{}) string { var buf bytes.Buffer - template.Must(template.New("").Parse(str)).Execute(&buf, object) + _ = template.Must(template.New("").Parse(str)).Execute(&buf, object) return buf.String() } diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go index 5bb1cbee..c7a91828 100644 --- a/pkg/utils/utils_test.go +++ b/pkg/utils/utils_test.go @@ -68,7 +68,7 @@ func TestNormalizeLinefeeds(t *testing.T) { byteArray []byte expected []byte } - var scenarios = []scenario{ + scenarios := []scenario{ { // \r\n []byte{97, 115, 100, 102, 13, 10}, diff --git a/scripts/generate_cheatsheet.go b/scripts/generate_cheatsheet.go index 2e653bc7..c1237701 100644 --- a/scripts/generate_cheatsheet.go +++ b/scripts/generate_cheatsheet.go @@ -12,7 +12,6 @@ import ( "fmt" "log" "os" - "strings" "github.com/jesseduffield/lazydocker/pkg/app" "github.com/jesseduffield/lazydocker/pkg/config" @@ -135,11 +134,3 @@ func formatSections(mApp *app.App, bindingSections []*bindingSection) string { return content } - -func getProjectRoot() string { - dir, err := os.Getwd() - if err != nil { - panic(err) - } - return strings.Split(dir, "lazydocker")[0] + "lazydocker" -}