knbr13 / gitcs

📈 Command line tool written in Go. It allows developers to scan their local Git repositories and generate a visual contributions graph.
MIT License
116 stars 11 forks source link

Fix out of range #6

Closed ddddddO closed 1 year ago

ddddddO commented 1 year ago

Hi! I wanted to use this tool, so I fixed the error! The fix might be a little subtle...

There was an error as shown below.

~/github.com/ddddddO/local-git-contributions-visualizer
14:13:45 > cat /home/ochi/.gogitlocalstats
/home/ochi/github.com/ddddddO/gtree~/github.com/ddddddO/local-git-contributions-visualizer
14:13:48 > go run *.go -email lbfdeatq@gmail.com

                         Jan             Feb             Mar             Apr                 May             Jun
       -   -   -   -   -   -   -   1   -   -   2   -   -   -   -   -   -   -   -   -   -   -   -   -   -   2   - panic: runtime error: index out of range [6] with length 6

goroutine 1 [running]:
main.printCells(0xc0000188f0?)
        /home/ochi/github.com/ddddddO/local-git-contributions-visualizer/stats.go:259 +0x165
main.printCommitsStats(0x772fe0?)
        /home/ochi/github.com/ddddddO/local-git-contributions-visualizer/stats.go:29 +0x35f
main.stats({0x7ffe3224d3f0?, 0xc00009a160?})
        /home/ochi/github.com/ddddddO/local-git-contributions-visualizer/stats.go:22 +0x48
main.main()
        /home/ochi/github.com/ddddddO/local-git-contributions-visualizer/main.go:18 +0x176
exit status 2

After modification, as shown below, it was able to run!

~/github.com/ddddddO/local-git-contributions-visualizer
14:14:30 > go run *.go -email lbfdeatq@gmail.com

                         Jan             Feb             Mar             Apr                 May             Jun
       -   -   -   -   -   -   -   1   -   -   2   -   -   -   -   -   -   -   -   -   -   -   -   -   -   2   -
 Fri   -   -   -   -   4   -   -   6   1   3   -   -   -   -   -   -   -   -   -   -   -   -   -   1   -   -   -   -
       -   -   -   -   -   -   -   -   3   -   -   -   -   -   -   -   -   -   -   -   -   1   -   -   -   -   -   -
 Wed   -   -   -   -   -   -   -   3   1   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       -   -   -   -   -   1   -   -   -   1   -   4   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
 Mon   -   -   -   -   1   -   -   7   3   -   3   -   -   -   -   -   -   -   1   -   -   -   -   -   -   2   4   -
       -   -   -   2   -   -   -   9   2   7   1   -   -   -   -   -   -   -   -   -   -   3   -   -   1   -   9

Below is an overall view of the terminal. local-git

knbr13 commented 1 year ago

Well done! Thank you for your contribution! I will merge your changes. However, I will be reverting the order of the imports. This adjustment is to maintain consistency with the coding style enforced by the Prettier extension in the project. Thanks again for your contribution!

ddddddO commented 1 year ago

Oops! I did indeed make a change from the subject matter.

Thanks for the merge!