如何调试“语法错误:{之前出现意外的分号或换行符”? [关闭]

package main

import"fmt"

func main()
{
  firstnu :34
  secondnu :50
  fmt.println("The sum is :", a + b)
}

bring the curly brace next to the main()

package main

import "fmt"

func main() {
    //..
}

Because, In Golang, Opening brace can't be placed on a separate line. Thanks to the automatic semicolon injection for the same.

Refer Go FAQ and Go Doc on Semicolons:

Why are there braces but no semicolons? And why can't I put the opening brace on the next line?

Go uses brace brackets for statement grouping, a syntax familiar to programmers who have worked with any language in the C family. Semicolons, however, are for parsers, not for people, and we wanted to eliminate them as much as possible. To achieve this goal, Go borrows a trick from BCPL: the semicolons that separate statements are in the formal grammar but are injected automatically, without lookahead, by the lexer at the end of any line that could be the end of a statement. This works very well in practice but has the effect that it forces a brace style. For instance, the opening brace of a function cannot appear on a line by itself.

So curly brace after main() function will solve the issue as Joel suggested.

func main() { // Opening brace on the same line
    // Actual implementation
}

Your code is incorrect

package main

import "fmt"

func main() {
  firstnu := 34
  secondnu := 50
  fmt.Println("The sum is :", firstnu + secondnu)
}