This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
const x int64 = 1 + 1<<33 | |
func main() { | |
var i = x | |
_ = i | |
} | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"sync/atomic" | |
"unsafe" | |
) | |
// lock-free queue | |
type LKQueue struct { | |
head unsafe.Pointer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sum(max int) int { | |
total := 0 | |
for i := 0; i < max; i++ { | |
total += i | |
} | |
return total | |
} | |
func fooWithDefer() { defer func() { sum(10) }() } | |
func fooWithoutDefer() { sum(10) } | |
func BenchmarkFooWithDefer(b *testing.B) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Test_server_SayHello(t *testing.T) { | |
certificate, err := tls.LoadX509KeyPair("./keys/client.crt", "./keys/client.key") | |
if err != nil { | |
log.Fatalf("Failed to load client key pair, %v", err) | |
} | |
certPool := x509.NewCertPool() | |
ca, err := os.ReadFile("./keys/ca.crt") | |
if err != nil { | |
log.Fatalf("Failed to read %s, error: %v", "./keys/ca.crt", err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
certificate, err := tls.LoadX509KeyPair("./keys/server.crt", "./keys/server.key") | |
if err != nil { | |
log.Fatalf("Failed to load key pair: %v", err) | |
} | |
certPool := x509.NewCertPool() | |
ca, err := os.ReadFile("./keys/ca.crt") | |
if err != nil { | |
log.Fatalf("Failed to read ca: %v", err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type testStruct2 struct { | |
c1 string | |
c2 string | |
c3 testStruct3 | |
} | |
type testStruct3 struct { | |
c31 string | |
c32 string | |
} | |
type testStructData struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package huizhou92 | |
import ( | |
"testing" | |
"unique" | |
) | |
var Token string | |
var tokenUnique unique.Handle[string] |