Initial commit: Go 1.23 release state

This commit is contained in:
Vorapol Rinsatitnon
2024-09-21 23:49:08 +10:00
commit 17cd57a668
13231 changed files with 3114330 additions and 0 deletions

17
test/syntax/chan.go Normal file
View File

@@ -0,0 +1,17 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type xyz struct {
ch chan
} // ERROR "unexpected .*}.* in channel type|missing channel element type"
func Foo(y chan) { // ERROR "unexpected .*\).* in channel type|missing channel element type"
}
func Bar(x chan, y int) { // ERROR "unexpected comma in channel type|missing channel element type"
}

17
test/syntax/chan1.go Normal file
View File

@@ -0,0 +1,17 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
var c chan int
var v int
func main() {
if c <- v { // ERROR "cannot use c <- v as value|send statement used as value"
}
}
var _ = c <- v // ERROR "unexpected <-|send statement used as value"

11
test/syntax/composite.go Normal file
View File

@@ -0,0 +1,11 @@
// errorcheck
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
var a = []int{
3 // ERROR "need trailing comma before newline in composite literal|possibly missing comma or }"
}

11
test/syntax/ddd.go Normal file
View File

@@ -0,0 +1,11 @@
// errorcheck
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func f() {
g(f..3) // ERROR "unexpected literal \.3, expected name or \("
}

12
test/syntax/else.go Normal file
View File

@@ -0,0 +1,12 @@
// errorcheck
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
if true {
} else ; // ERROR "else must be followed by if or statement block|expected .if. or .{."
}

18
test/syntax/if.go Normal file
View File

@@ -0,0 +1,18 @@
// errorcheck
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func x() {
}
func main() {
if { // ERROR "missing condition"
}
if x(); { // ERROR "missing condition"
}
}

14
test/syntax/import.go Normal file
View File

@@ -0,0 +1,14 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"io", // ERROR "unexpected comma"
"os"
)

15
test/syntax/initvar.go Normal file
View File

@@ -0,0 +1,15 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
if var x = 0; x < 10 {} // ERROR "var declaration not allowed in if initializer"
switch var x = 0; x {} // ERROR "var declaration not allowed in switch initializer"
for var x = 0; x < 10; {} // ERROR "var declaration not allowed in for initializer"
}

14
test/syntax/semi1.go Normal file
View File

@@ -0,0 +1,14 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
if x; y // ERROR "expected .*{.* after if clause|undefined"
{
z // GCCGO_ERROR "undefined"

14
test/syntax/semi2.go Normal file
View File

@@ -0,0 +1,14 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
switch x; y // ERROR "missing .*{.* after switch clause|undefined"
{
z

14
test/syntax/semi3.go Normal file
View File

@@ -0,0 +1,14 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
for x; y; z // ERROR "expected .*{.* after for clause|undefined"
{
z // GCCGO_ERROR "undefined"

12
test/syntax/semi4.go Normal file
View File

@@ -0,0 +1,12 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
for x // GCCGO_ERROR "undefined"
{ // ERROR "unexpected {, expected for loop condition|expecting .*{.* after for clause"
z // GCCGO_ERROR "undefined"

13
test/syntax/semi5.go Normal file
View File

@@ -0,0 +1,13 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main()
{ // ERROR "unexpected semicolon or newline before .?{.?"

11
test/syntax/semi6.go Normal file
View File

@@ -0,0 +1,11 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type T1 // ERROR "newline in type declaration"
type T2 /* // ERROR "(semicolon.*|EOF) in type declaration" */

14
test/syntax/semi7.go Normal file
View File

@@ -0,0 +1,14 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
if x { } // GCCGO_ERROR "undefined"
else { } // ERROR "unexpected semicolon or newline before .?else.?|unexpected else"
}

20
test/syntax/topexpr.go Normal file
View File

@@ -0,0 +1,20 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
fmt.Printf("hello") // ERROR "non-declaration statement outside function body|expected declaration"
func main() {
}
x++ // ERROR "non-declaration statement outside function body|expected declaration"
func init() {
}
x,y := 1, 2 // ERROR "non-declaration statement outside function body|expected declaration"

13
test/syntax/typesw.go Normal file
View File

@@ -0,0 +1,13 @@
// errorcheck
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
switch main() := interface{}(nil).(type) { // ERROR "invalid variable name|cannot use .* as value"
default:
}
}

10
test/syntax/vareq.go Normal file
View File

@@ -0,0 +1,10 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
var x map[string]string{"a":"b"} // ERROR "unexpected { at end of statement|expected ';' or '}' or newline"

10
test/syntax/vareq1.go Normal file
View File

@@ -0,0 +1,10 @@
// errorcheck
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
var x map[string]string{"a":"b"} // ERROR "unexpected { at end of statement|unexpected { after top level declaration|expected ';' or newline after top level declaration"