一个逗号引发的语法报错问题:syntax error: unexpected newline, expecting comma or }或者missing ',' before newline in composite literal

  代码如下:

  

func main() {
	boxes := Boxlist{
		Box{4, 4, 4, RED},
		Box{5, 5, 5, YELLOW},
		Box{6, 6, 6, BLACK},
		Box{10, 10, 10, BLUE},
		Box{8, 8, 8, WHITE}, // 此处逗号不可省略   115:19: missing ',' before newline in composite literal
	}


func main() {
	a := map[string]int{
		"golang": 2,
		"python": 1,
		"java":   3, // syntax error: unexpected newline, expecting comma or }
	}
	Println(a)
}

 

  

 

相关文章:

  • 2021-07-06
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2021-09-06
  • 2021-10-02
  • 2022-01-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
  • 2021-08-29
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案