/* and terminates with the first subsequent occurrence of */.
Lexical Characteristics
Token Parsing During lexical analysis, the Go scanner evaluates block comments as whitespace. The exact interpretation depends on the contents of the comment:- If the block comment contains one or more newline characters (
\n), the scanner treats the entire comment as a single newline. This is critical for Go’s automatic semicolon insertion rules. - If the block comment contains no newlines, the scanner treats it as a single space character.
*/ sequence it encounters, regardless of how many opening /* sequences preceded it. Attempting to nest block comments will expose the trailing text to the compiler, resulting in a syntax error.
Tired of Poor Go Skills? Fix That With Deep Grasping!Learn More





