@@ -219,7 +219,7 @@ func parseLog(filename string) (*LogData, error) {
219219 if err != nil {
220220 return nil , fmt .Errorf ("open file: %w" , err )
221221 }
222- defer file .Close ()
222+ defer func () { _ = file .Close () } ()
223223
224224 data := & LogData {Filename : filename }
225225 scanner := bufio .NewScanner (file )
@@ -540,7 +540,6 @@ func printDetailedStats(data *LogData) {
540540 var totalCodeBlocks , totalLLMCalls int
541541 var totalPromptTokens , totalCompletionTokens int
542542 var iterTimes []float64
543- var codeExecTimes []float64
544543 var llmCallTimes []float64
545544
546545 for _ , iter := range data .Iterations {
@@ -549,7 +548,6 @@ func printDetailedStats(data *LogData) {
549548 totalCodeBlocks += len (iter .CodeBlocks )
550549
551550 for _ , block := range iter .CodeBlocks {
552- codeExecTimes = append (codeExecTimes , block .Result .ExecutionTime )
553551 for _ , call := range block .Result .RLMCalls {
554552 totalLLMCalls ++
555553 totalPromptTokens += call .PromptTokens
@@ -691,7 +689,7 @@ func runInteractive(data *LogData, cfg ViewerConfig) {
691689 viewLog (data , cfg )
692690 return
693691 }
694- defer term .Restore (int (os .Stdin .Fd ()), oldState )
692+ defer func () { _ = term .Restore (int (os .Stdin .Fd ()), oldState ) }( )
695693
696694 currentIdx := 0
697695 expanded := ! cfg .Compact
@@ -716,7 +714,8 @@ func runInteractive(data *LogData, cfg ViewerConfig) {
716714 break
717715 }
718716
719- if n == 1 {
717+ switch n {
718+ case 1 :
720719 switch buf [0 ] {
721720 case 'q' , 3 : // q or Ctrl+C
722721 clearScreen ()
@@ -746,7 +745,7 @@ func runInteractive(data *LogData, cfg ViewerConfig) {
746745 currentIdx = searchResults [searchIdx ]
747746 }
748747 case '/' :
749- term .Restore (int (os .Stdin .Fd ()), oldState )
748+ _ = term .Restore (int (os .Stdin .Fd ()), oldState )
750749 fmt .Print ("\r \033 [K/" )
751750 reader := bufio .NewReader (os .Stdin )
752751 query , _ := reader .ReadString ('\n' )
@@ -756,25 +755,25 @@ func runInteractive(data *LogData, cfg ViewerConfig) {
756755 if len (searchResults ) > 0 {
757756 currentIdx = searchResults [0 ]
758757 }
759- term .MakeRaw (int (os .Stdin .Fd ()))
758+ _ , _ = term .MakeRaw (int (os .Stdin .Fd ()))
760759 case 's' :
761760 // Show stats
762- term .Restore (int (os .Stdin .Fd ()), oldState )
761+ _ = term .Restore (int (os .Stdin .Fd ()), oldState )
763762 clearScreen ()
764763 printDetailedStats (data )
765764 fmt .Print ("\n Press any key to continue..." )
766- os .Stdin .Read (make ([]byte , 1 ))
767- term .MakeRaw (int (os .Stdin .Fd ()))
765+ _ , _ = os .Stdin .Read (make ([]byte , 1 ))
766+ _ , _ = term .MakeRaw (int (os .Stdin .Fd ()))
768767 case '?' :
769768 // Show help
770- term .Restore (int (os .Stdin .Fd ()), oldState )
769+ _ = term .Restore (int (os .Stdin .Fd ()), oldState )
771770 clearScreen ()
772771 printInteractiveHelp ()
773772 fmt .Print ("\n Press any key to continue..." )
774- os .Stdin .Read (make ([]byte , 1 ))
775- term .MakeRaw (int (os .Stdin .Fd ()))
773+ _ , _ = os .Stdin .Read (make ([]byte , 1 ))
774+ _ , _ = term .MakeRaw (int (os .Stdin .Fd ()))
776775 }
777- } else if n == 3 {
776+ case 3 :
778777 // Arrow keys
779778 if buf [0 ] == 27 && buf [1 ] == 91 {
780779 switch buf [2 ] {
0 commit comments