Skip to content

Conversation

@mshedsilegx
Copy link

1- Resolved 51 security vulnerabilities by updating modules as much as possible
2- 4 go vet issues
3- 51 linting issues detected by golangci-lint

mshedsilegx and others added 26 commits July 25, 2025 15:06
This commit addresses issues identified by the `go vet` command.

- In `menus.go`, unkeyed struct literals for `menu.Item` have been converted to keyed literals to improve code clarity and maintainability.
- In `main.go`, unreachable code following a `panic()` call in the `panicExit` function has been removed.
This commit addresses a wide range of issues identified by the `golangci-lint` command. The changes include:

- Handling previously unchecked errors.
- Removing deprecated `+build` tags and replacing them with `//go:build` directives.
- Replacing deprecated function calls, including `rand.Seed`, `io/ioutil`, and `InspectContainer`.
- Fixing ineffective assignments and break statements.
- Correcting error string formatting.
- Removing redundant assignments and break statements.
- Simplifying string replacements.
- Removing a significant amount of unused code, including functions, variables, and fields.
This commit adds the `LINTING.md` file, which contains a detailed code review and summary of the changes made to address the issues reported by `go vet` and `golangci-lint`.
This commit introduces the `ARCHITECTURE.md` file, which provides a detailed explanation of the ctop application's architecture and design.

The document includes:
- An overview of the application and its objectives.
- A breakdown of the architecture and key design choices, including the connector interface, data model, and concurrency model.
- A comprehensive list of command-line arguments with descriptions, types, and default values.
- Examples of how to use the application.
This commit adds support for executing shells on Windows by checking the operating system and using "cmd.exe" when running on a Windows environment. The existing functionality for Linux and other Unix-like systems is preserved.
This commit adds support for executing shells on Windows by checking the operating system and using "cmd.exe" when running on a Windows environment. The existing functionality for Linux and other Unix-like systems is preserved.
This commit enhances the `ExecShell` functionality on Windows by:
- Clearing the screen before launching the shell using `cmd.exe /c "cls && cmd.exe"`.
- Refreshing the display after the shell exits to prevent UI corruption.

This provides a cleaner and more reliable user experience on Windows, while preserving the existing behavior on other platforms.
This commit enhances the `ExecShell` functionality on Windows by:
- Clearing the screen before launching the shell using `cmd.exe /c "cls && cmd.exe"`.
- Refreshing the display after the shell exits to prevent UI corruption, only on Windows.
- Handling the error returned by `RefreshDisplay()`.

This provides a cleaner and more reliable user experience on Windows, while preserving the existing behavior on other platforms.
This commit resolves an issue where the termui TUI would interfere with the shell session when running `ctop` on a Windows host and connecting to a Windows container. This interference caused ANSI escape codes to corrupt the shell display.

The `ExecShell` function is modified to:
1.  Check if the host OS is Windows.
2.  If it is Windows, use `cmd.exe` as the shell to execute in the container.
3.  Crucially, the `termui` interface is now properly suspended (`ui.Close()`) before executing the shell and re-initialized (`ui.Init()`) and refreshed afterward.

This prevents the TUI from leaking control codes into the shell session, providing a clean and usable shell experience on Windows. The existing behavior for Linux and macOS hosts is preserved.
This commit resolves an issue where the termui TUI would interfere with the shell session when running `ctop` on a Windows host and connecting to a Windows container. This interference caused ANSI escape codes to corrupt the shell display.

The `ExecShell` function is modified to:
1.  Check if the host OS is Windows.
2.  If it is Windows, use `cmd.exe` as the shell to execute in the container.
3.  Crucially, the `termui` interface is now properly suspended (`ui.Close()`) before executing the shell and re-initialized (`ui.Init()`) and refreshed afterward.

This prevents the TUI from leaking control codes into the shell session, providing a clean and usable shell experience on Windows. The existing behavior for Linux and macOS hosts is preserved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant