Go Comment

If you want to write some notes in your Go code file which you do not want to show or execute but want to include in your Go code file for better understanding your code. So for it you can create comments in Go lang. These comments present in your file but, these all will be ignored by the browser. There are two types of comments in Go, single line comment and multi line comment. You can start single line Go comments with // sign and you can write your text following that. And multi line Go comment starts with /* and ends with */. Examples of Go comments are mentioned below: Single Line Comment


// This is a single line comment
package main
import ("fmt")

func main() {
  // This is a single line comment
  fmt.Println("Hello all from evidenttutorials")
}
Multi line Comment

/* This is a 
multi line comment
*/
package main
import ("fmt")

func main() {
/* This is a 
multi line comment
*/
  fmt.Println("Hello all from evidenttutorials")
}