Skip to content

Instantly share code, notes, and snippets.

@cep21
Last active June 24, 2022 02:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cep21/6769d3be13d3d752ffa0596fca9b1192 to your computer and use it in GitHub Desktop.
Save cep21/6769d3be13d3d752ffa0596fca9b1192 to your computer and use it in GitHub Desktop.
Example test
package main
import (
"sync"
"testing"
)
func TestAppend(t *testing.T) {
x := []string{"start"}
wg := sync.WaitGroup{}
wg.Add(2)
go func() {
defer wg.Done()
y := append(x, "hello", "world")
t.Log(cap(y), len(y))
}()
go func() {
defer wg.Done()
z := append(x, "goodbye", "bob")
t.Log(cap(z), len(z))
}()
wg.Wait()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment