summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-07 22:29:23 +0300
committerPaul Buetow <paul@buetow.org>2026-04-07 22:29:23 +0300
commitf9c7585730d2d119939a6e1e503684ca6ff2e086 (patch)
tree92f5b3aa920e2b996bd51bf0044cf33922c0b08b
parente0919c1dcdc28603c19cb9255c4f6d28c5ae401a (diff)
cleanup
-rw-r--r--cmd/totalrecall/main.go17
-rw-r--r--go_best_practices_audit.md87
2 files changed, 11 insertions, 93 deletions
diff --git a/cmd/totalrecall/main.go b/cmd/totalrecall/main.go
index c991378..a0444b2 100644
--- a/cmd/totalrecall/main.go
+++ b/cmd/totalrecall/main.go
@@ -113,7 +113,7 @@ func runCommand(cmd *cobra.Command, args []string, flags *cli.Flags) error {
OutputDir: ".",
Style: flags.StoryStyle,
Theme: flags.StoryTheme,
- UltraRealistic: storyUltraRealistic(flags.StoryNoUltraRealistic),
+ UltraRealistic: storyUltraRealistic(flags.StoryNoUltraRealistic, flags.StoryUltraRealistic),
NarratorVoice: flags.NarratorVoice,
NarrateEnabled: flags.NarrateEnabled,
Slug: flags.StorySlug,
@@ -221,11 +221,16 @@ func runStoryVideos(flags *cli.Flags) error {
return nil
}
-// storyUltraRealistic converts the --no-ultra-realistic bool flag into a *bool
-// for RunnerConfig. When noUltraRealistic is true, returns a pointer to false
-// (forcing standard comic style). When false (flag not set), returns nil so
-// the runner picks randomly 50/50 each run.
-func storyUltraRealistic(noUltraRealistic bool) *bool {
+// storyUltraRealistic converts the --ultra-realistic / --no-ultra-realistic
+// bool flags into a *bool for RunnerConfig.
+// - --ultra-realistic → pointer to true (force photorealistic panels)
+// - --no-ultra-realistic → pointer to false (force standard comic style)
+// - neither flag set → nil (runner picks randomly 50/50 each run)
+func storyUltraRealistic(noUltraRealistic, ultraRealistic bool) *bool {
+ if ultraRealistic {
+ v := true
+ return &v
+ }
if noUltraRealistic {
v := false
return &v
diff --git a/go_best_practices_audit.md b/go_best_practices_audit.md
deleted file mode 100644
index d27ee7b..0000000
--- a/go_best_practices_audit.md
+++ /dev/null
@@ -1,87 +0,0 @@
-# Go Best Practices Audit Report
-
-## Overview
-This report summarizes the findings from a Go best practices audit of the totalrecall project conducted on 2026-03-22. The audit focused on project structure, style, conventions, and potential improvements based on Go best practices.
-
-## Findings
-
-### 1. Style Issues (Low Severity)
-Several minor style issues were identified by staticcheck that can be improved for code clarity and consistency.
-
-#### a. Use tagged switch instead of if-else chain
-- **File**: `internal/gui/app.go:529`
-- **Description**: The code uses an if-else chain to check the `translationDirection` string variable. Since there are only two possible values ("en-to-bg" and "bg-to-en"), a tagged switch statement would be more appropriate and readable.
-- **Recommendation**: Replace the if-else chain with a switch statement on `translationDirection`.
-- **Example**:
- ```go
- switch translationDirection {
- case "en-to-bg":
- // handle English to Bulgarian translation
- case "bg-to-en":
- // handle Bulgarian to English translation
- }
- ```
-
-#### b. Unnecessary fmt.Sprintf on string arguments
-- **Files**:
- - `internal/gui/app.go:2730`
- - `internal/phonetic/fetcher.go:46`
- - `internal/image/openai.go:211`
-- **Description**: In several places, `fmt.Sprintf("%s", arg)` is used where `arg` is already a string. This is unnecessary and less efficient than direct assignment.
-- **Recommendation**: Replace `fmt.Sprintf("%s", arg)` with just `arg`.
-- **Examples**:
- ```go
- // Before
- Content: fmt.Sprintf("%s", word),
- // After
- Content: word,
-
- // Before
- attribution := fmt.Sprintf("Image generated by OpenAI DALL-E\n\n")
- // After
- attribution := "Image generated by OpenAI DALL-E\n\n"
- ```
-
-### 2. Project Structure (Good Practices)
-The project follows recommended Go project structure conventions:
-- **cmd/**: Contains the main application (`cmd/totalrecall/main.go`)
-- **internal/**: Contains private application code, properly organized by functionality
-- **No pkg/ directory**: Appropriate for an application (as opposed to a library)
-- **assets/**: Contains non-Go resources (icons, configuration examples, etc.)
-
-### 3. Dependency Management (Good Practices)
-- Uses Go modules correctly with a `go.mod` file
-- Dependencies are properly versioned
-- Standard library and popular third-party packages are used appropriately
-
-### 4. Error Handling (Good Practices)
-- Errors are properly checked and handled throughout the codebase
-- Error wrapping with `%w` is used where appropriate
-- Context propagation is observed in API calls
-
-### 5. Testing (Good Practices)
-- Comprehensive test suite exists for internal packages
-- Tests cover various functions and edge cases
-- Mocking is used where appropriate to avoid external API calls in unit tests
-
-### 6. Configuration Management (Good Practices)
-- Uses Viper for configuration management
-- Supports configuration files, environment variables, and command-line flags
-- Default values are provided for configuration options
-
-## Conclusion
-The totalrecall project demonstrates good adherence to Go best practices overall. The codebase is well-structured, follows conventional Go project layout, and implements proper error handling and testing.
-
-The identified issues are primarily minor style improvements that would enhance code readability and maintainability but do not affect correctness or security. Addressing these staticcheck suggestions would bring the code in line with idiomatic Go practices.
-
-## Recommendations
-1. Address the four staticcheck issues mentioned above to improve code quality.
-2. Consider adding more detailed comments to complex functions, particularly in the processor and GUI packages.
-3. Ensure that all public functions have appropriate godoc comments.
-4. Continue to maintain the existing testing practices as the project evolves.
-
-## Audit Details
-- **Audit Date**: 2026-03-22
-- **Auditor**: Coding Assistant
-- **Tools Used**: golangci-lint (v2.11.3), go vet, manual code review
-- **Scope**: All Go files in the repository \ No newline at end of file