Grew up in Russia, lived in the States, moved to Germany, sometimes live in Spain. I program since I was 13. I used to program games, maps and now I reverse engineer password managers and other stuff
Location
Berlin and Málaga
Education
MS in CS from State Polytechnic University of St. Petersburg
In prepAndMove you have quite some repetition. I would make a map of extension to document type:
jpg:imagepng:imagetxt:document...
This way you can remove the duplicate code. Also your config would look cleaner (simple data vs scattered code) and could even be loaded in runtime from an external file.
Thanks for the comment! I kind of touched on that in the post. I have given myself an arbitrary time limit to get these posts up. It was looking like I may not hit it so I never went back and added it. The original plan was a map[string][]string with the document folder and then the array of extensions. As it is now, the switch wouldn't be that bad if I got rid of the repetitive error code as well.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In
prepAndMove
you have quite some repetition. I would make a map of extension to document type:This way you can remove the duplicate code. Also your config would look cleaner (simple data vs scattered code) and could even be loaded in runtime from an external file.
Thanks for the comment! I kind of touched on that in the post. I have given myself an arbitrary time limit to get these posts up. It was looking like I may not hit it so I never went back and added it. The original plan was a
map[string][]string
with the document folder and then the array of extensions. As it is now, the switch wouldn't be that bad if I got rid of the repetitive error code as well.