mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-29 09:32:38 +00:00
7259b46773
This change removes most usages of Syntax() from the repository and uses edition features for instead. The appropriate edition feature defaults are loaded for proto2/proto3 when the initialization of the descriptors start. All of these changes were tested on the Google corpus. Change-Id: Ieca076a2b38ca8e50e084cd32e725b7b3dcb4171 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/572435 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Stapelberg <stapelberg@google.com>
29 lines
695 B
Go
29 lines
695 B
Go
// Copyright 2024 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 race_test
|
|
|
|
import (
|
|
"sync"
|
|
"testing"
|
|
|
|
epb "google.golang.org/protobuf/internal/testprotos/messageset/msetextpb"
|
|
)
|
|
|
|
// There must be no other test in this package as we are testing global
|
|
// initialization which only happens once per binary.
|
|
func TestConcurrentInitialization(t *testing.T) {
|
|
var wg sync.WaitGroup
|
|
wg.Add(2)
|
|
go func() {
|
|
defer wg.Done()
|
|
epb.E_Ext1_MessageSetExtension.ValueOf(&epb.Ext1{})
|
|
}()
|
|
go func() {
|
|
defer wg.Done()
|
|
epb.E_Ext1_MessageSetExtension.TypeDescriptor().Message()
|
|
}()
|
|
wg.Wait()
|
|
}
|