I always put my flour in clear plastic containers so I can see how much I have left. I also put bay leaves in with the flour, as the eggs/larval stages of a lot of grain pests are susceptible to their eugenol. [0,1]
For anything long term I pour the flour out onto long trays, let it reach 0°F/-18°C in my freezer and keeping it there for 3 days, then storing it in food safe 5-gallon buckets with bay leaves and oxygen absorbers, though some also use dry ice. [2]
weevils/beetles all absolutely suck.
[0] - https://www.tandfonline.com/doi/abs/10.1080/096708797229040?...
[1] - https://www.tandfonline.com/doi/abs/10.1080/096708799227950
[2] - https://scholarsarchive.byu.edu/cgi/viewcontent.cgi?article=...