Go language warnings and errors

后端 未结 4 1093
刺人心
刺人心 2021-02-19 18:08

It seems that GO language does not have warnings in it. I\'ve observed few instances. 1. \"declared and not used\"(if variable is declared and not used anywhere it gives an e

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-19 19:03

    Go is trying to prevent this situation:

    The boy is smoking and leaving smoke rings into the air. The girl gets irritated with the smoke and says to her lover: "Can't you see the warning written on the cigarettes packet, smoking is injurious to health!"

    The boy replies back: "Darling, I am a programmer. We don't worry about warnings, we only worry about errors."

    Basically, Go just wont let you get away with unused variables and unused imports and other stuff that is normally a warning on other languages. It helps put you in a good habit.

提交回复
热议问题