I know that the use of; in GOlang, but for the compiler of Golang that is more efficient, what should we say or not?
I know that the use of; in GOlang, but for the compiler of Golang that is more efficient, what should we say or not?
Source: link
As in C, Go's formal grammar uses semicolons to end statements, but unlike C, those semicolons do not appear in the source. Instead the lexical analyzer when scanning the source uses a simple rule to insert semicolons automatically, so input, the text is mostly free of them.
The lexical analyzer always inserts a semicolon after the symbol. This could be summarized as, "if the new line comes after a segment that could finish a statement, insert a semicolon".
That is, the semicolon is added by the lexical analyzer, and as I have read in several sources, you do not put a semicolon to make the code cleaner, you can see that the go packages (¿C: / Go / src?) Do not wear it.
In addition, gofmt removes the semicolons of the code when you're programming Go in Visual Studio, for example, so, whether it's better for the compiler or not, the Go bases "stipulate" that you do not have to put it.
You can also read link for more information.