View errors by: Date Added Package/Type

invalid identifier character U+201C '“'

go build "invalid identifier character U+201C '“'"

What causes the error?

This error, and many other invalid identifier errors like it, stem from using an invalid character in your Go code. In this particular case, the issue stems from those weird curved quotation marks - and - which are different from the quotation marks you normally type. An example is shown below.

func main() {
  // this line cause a compilation error

The most common way this error is introduced is by copy/pasting code from a website or an application that replaces regular quotation marks with these special ones.

It is important to note that you are allowed to have these quotes inside of a string, but they can’t be used to start and end a string. For instance, the following code is valid and will compile because the special quoatation characters are inside a string.

func main() {

How can I fix it?

The simple solution here is to find all instances of the incorrect quotation marks in your code and replace them with the regular quotation mark. Just be sure not to remove any you intended to have inside of a string.

Created by Jon Calhoun, but you can check out the source and contribute on GitHub