diff --git a/third-party/thrift/src/thrift/compiler/generate/templates/go/metadata.go.mustache b/third-party/thrift/src/thrift/compiler/generate/templates/go/metadata.go.mustache index 4580462478651..971e33de8fe0f 100644 --- a/third-party/thrift/src/thrift/compiler/generate/templates/go/metadata.go.mustache +++ b/third-party/thrift/src/thrift/compiler/generate/templates/go/metadata.go.mustache @@ -25,6 +25,8 @@ }}{{> common/header}} import ( + "maps" + {{#program:thrift_imports}} {{program:go_package_alias}} "{{program:go_import_path}}" {{/program:thrift_imports}} @@ -34,19 +36,10 @@ import ( {{/program:import_metadata_package?}} ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - {{> common/unused_imports_protection}} // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] {{#program:import_metadata_package?}} var _ = metadata.GoUnusedProtection__ {{/program:import_metadata_package?}} @@ -113,7 +106,7 @@ func GetEnumsMetadata() map[string]*{{program:metadata_qualifier}}ThriftEnum { // ...now add enum metadatas from recursively included programs. {{#program:thrift_imports}} - mapsCopy(allEnumsMap, {{program:go_package_alias}}.GetEnumsMetadata()) + maps.Copy(allEnumsMap, {{program:go_package_alias}}.GetEnumsMetadata()) {{/program:thrift_imports}} return allEnumsMap @@ -130,7 +123,7 @@ func GetStructsMetadata() map[string]*{{program:metadata_qualifier}}ThriftStruct // ...now add struct metadatas from recursively included programs. {{#program:thrift_imports}} - mapsCopy(allStructsMap, {{program:go_package_alias}}.GetStructsMetadata()) + maps.Copy(allStructsMap, {{program:go_package_alias}}.GetStructsMetadata()) {{/program:thrift_imports}} return allStructsMap @@ -147,7 +140,7 @@ func GetExceptionsMetadata() map[string]*{{program:metadata_qualifier}}ThriftExc // ...now add exception metadatas from recursively included programs. {{#program:thrift_imports}} - mapsCopy(allExceptionsMap, {{program:go_package_alias}}.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, {{program:go_package_alias}}.GetExceptionsMetadata()) {{/program:thrift_imports}} return allExceptionsMap @@ -164,7 +157,7 @@ func GetServicesMetadata() map[string]*{{program:metadata_qualifier}}ThriftServi // ...now add service metadatas from recursively included programs. {{#program:thrift_imports}} - mapsCopy(allServicesMap, {{program:go_package_alias}}.GetServicesMetadata()) + maps.Copy(allServicesMap, {{program:go_package_alias}}.GetServicesMetadata()) {{/program:thrift_imports}} return allServicesMap diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/metadata.go index 1edaf6b1fd00e..9ff16c283970f 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/metadata.go index b219f2e5493c0..c5e24edef7744 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -6,22 +6,15 @@ package cpp import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/metadata.go index 630d4543a1800..3769dfc875485 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/hack/metadata.go @@ -6,22 +6,15 @@ package hack import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/metadata.go index 532b72194d95e..a753cf7392f3e 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/python/metadata.go @@ -6,22 +6,15 @@ package python import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/metadata.go index 7e3d263e2ffb2..55b07054e3d7e 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/rust/metadata.go @@ -6,22 +6,15 @@ package rust import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/metadata.go index 7355ce2ee32f7..6ceb68af389a5 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/metadata.go index b219f2e5493c0..c5e24edef7744 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -6,22 +6,15 @@ package cpp import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/metadata.go index 79738ce046fb8..7f489015be1ee 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/go/metadata.go @@ -6,22 +6,15 @@ package go_ import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/metadata.go index 630d4543a1800..3769dfc875485 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/hack/metadata.go @@ -6,22 +6,15 @@ package hack import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/metadata.go index 2771e1c05cecb..42ae4cf61b650 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/metadata.go index 630d4543a1800..3769dfc875485 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/hack/metadata.go @@ -6,22 +6,15 @@ package hack import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/basic/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/metadata.go index e3a9f5d4418a4..0633f21ea9bc3 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/metadata.go index b219f2e5493c0..c5e24edef7744 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -6,22 +6,15 @@ package cpp import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/complex-union/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/metadata.go index 6f3b351a0927b..abb2fb5166844 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/constants/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/metadata.go index cf5548e958a39..2cfe26807eba1 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/default_values/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/metadata.go index 9b7ec7f33ba81..39b68dd910fb5 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/metadata.go index 2754c1253db73..c7099727f35c5 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/empty-struct/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/metadata.go index 95db2b6f5e51a..72533f3256fdd 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/enums/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/metadata.go index bd20efe98bf4c..2812ae5219863 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/metadata.go index 532b72194d95e..a753cf7392f3e 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/python/metadata.go @@ -6,22 +6,15 @@ package python import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/exceptions/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/metadata.go index d952157e4ca96..ecbd87a082fe5 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/go-service/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/metadata.go index 1e05cb97235de..3439da54949e5 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module0/gen-go/module0/metadata.go @@ -6,22 +6,15 @@ package module0 import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/metadata.go index 310102856c618..5145036fa05d1 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module0/metadata.go @@ -6,22 +6,15 @@ package module0 import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/metadata.go index bb2efbc7f3959..784fc10578ad5 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module1/metadata.go @@ -6,26 +6,19 @@ package module1 import ( + "maps" + module0 "module0" module2 "module2" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = module0.GoUnusedProtection__ var _ = module2.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -303,8 +296,8 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, module0.GetEnumsMetadata()) - mapsCopy(allEnumsMap, module2.GetEnumsMetadata()) + maps.Copy(allEnumsMap, module0.GetEnumsMetadata()) + maps.Copy(allEnumsMap, module2.GetEnumsMetadata()) return allEnumsMap } @@ -319,8 +312,8 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, module0.GetStructsMetadata()) - mapsCopy(allStructsMap, module2.GetStructsMetadata()) + maps.Copy(allStructsMap, module0.GetStructsMetadata()) + maps.Copy(allStructsMap, module2.GetStructsMetadata()) return allStructsMap } @@ -335,8 +328,8 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, module0.GetExceptionsMetadata()) - mapsCopy(allExceptionsMap, module2.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, module0.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, module2.GetExceptionsMetadata()) return allExceptionsMap } @@ -351,8 +344,8 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, module0.GetServicesMetadata()) - mapsCopy(allServicesMap, module2.GetServicesMetadata()) + maps.Copy(allServicesMap, module0.GetServicesMetadata()) + maps.Copy(allServicesMap, module2.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/metadata.go index 4468ea50b80f1..32abf9f80da41 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/module2/metadata.go @@ -6,22 +6,15 @@ package module2 import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/metadata.go index 79738ce046fb8..7f489015be1ee 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/go/metadata.go @@ -6,22 +6,15 @@ package go_ import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module1/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/metadata.go index eb28e4ffa8c82..61fd0137092b4 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/go-typedef/out/go_module2/gen-go/module2/metadata.go @@ -6,22 +6,15 @@ package module2 import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/metadata.go index 0f8da00d8ee2c..c34c7d77330aa 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/IncludesAlso/metadata.go @@ -6,22 +6,15 @@ package IncludesAlso import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/metadata.go index 7007f48c2df98..4d3f0fcfdebd9 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_matching_names/gen-go/matching_names/metadata.go @@ -6,24 +6,17 @@ package matching_names import ( + "maps" + includesAlso "IncludesAlso" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = includesAlso.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -82,7 +75,7 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, includesAlso.GetEnumsMetadata()) + maps.Copy(allEnumsMap, includesAlso.GetEnumsMetadata()) return allEnumsMap } @@ -97,7 +90,7 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, includesAlso.GetStructsMetadata()) + maps.Copy(allStructsMap, includesAlso.GetStructsMetadata()) return allStructsMap } @@ -112,7 +105,7 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, includesAlso.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, includesAlso.GetExceptionsMetadata()) return allExceptionsMap } @@ -127,7 +120,7 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, includesAlso.GetServicesMetadata()) + maps.Copy(allServicesMap, includesAlso.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/metadata.go index 4b8f1c710aacc..0ca04d80fd93b 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/includes/metadata.go @@ -6,24 +6,17 @@ package includes import ( + "maps" + transitive "transitive" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = transitive.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -90,7 +83,7 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, transitive.GetEnumsMetadata()) + maps.Copy(allEnumsMap, transitive.GetEnumsMetadata()) return allEnumsMap } @@ -105,7 +98,7 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, transitive.GetStructsMetadata()) + maps.Copy(allStructsMap, transitive.GetStructsMetadata()) return allStructsMap } @@ -120,7 +113,7 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, transitive.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, transitive.GetExceptionsMetadata()) return allExceptionsMap } @@ -135,7 +128,7 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, transitive.GetServicesMetadata()) + maps.Copy(allServicesMap, transitive.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/metadata.go index 3bb8f84db9a7d..71c55ca617233 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/module/metadata.go @@ -6,24 +6,17 @@ package module import ( + "maps" + includes "includes" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = includes.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -100,7 +93,7 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, includes.GetEnumsMetadata()) + maps.Copy(allEnumsMap, includes.GetEnumsMetadata()) return allEnumsMap } @@ -115,7 +108,7 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, includes.GetStructsMetadata()) + maps.Copy(allStructsMap, includes.GetStructsMetadata()) return allStructsMap } @@ -130,7 +123,7 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, includes.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, includes.GetExceptionsMetadata()) return allExceptionsMap } @@ -145,7 +138,7 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, includes.GetServicesMetadata()) + maps.Copy(allServicesMap, includes.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/metadata.go index c144a1153520d..5aad82d24f10e 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/service/metadata.go @@ -6,26 +6,19 @@ package service import ( + "maps" + module "module" includes "includes" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = module.GoUnusedProtection__ var _ = includes.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -130,8 +123,8 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, module.GetEnumsMetadata()) - mapsCopy(allEnumsMap, includes.GetEnumsMetadata()) + maps.Copy(allEnumsMap, module.GetEnumsMetadata()) + maps.Copy(allEnumsMap, includes.GetEnumsMetadata()) return allEnumsMap } @@ -146,8 +139,8 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, module.GetStructsMetadata()) - mapsCopy(allStructsMap, includes.GetStructsMetadata()) + maps.Copy(allStructsMap, module.GetStructsMetadata()) + maps.Copy(allStructsMap, includes.GetStructsMetadata()) return allStructsMap } @@ -162,8 +155,8 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, module.GetExceptionsMetadata()) - mapsCopy(allExceptionsMap, includes.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, module.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, includes.GetExceptionsMetadata()) return allExceptionsMap } @@ -178,8 +171,8 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, module.GetServicesMetadata()) - mapsCopy(allServicesMap, includes.GetServicesMetadata()) + maps.Copy(allServicesMap, module.GetServicesMetadata()) + maps.Copy(allServicesMap, includes.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/metadata.go index 4df684a77ff5c..a4ec7afc2c23c 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/includes/out/go_service/gen-go/transitive/metadata.go @@ -6,22 +6,15 @@ package transitive import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/metadata.go index 80864457f025a..da1210d25fb5d 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inheritance/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/metadata.go index 4aa540acfc91d..06252ab047aee 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/foo/metadata.go @@ -6,22 +6,15 @@ package foo import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/metadata.go index ad613149dcd9c..e1f6b7513b64c 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/module/metadata.go @@ -6,24 +6,17 @@ package module import ( + "maps" + foo "foo" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = foo.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -137,7 +130,7 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, foo.GetEnumsMetadata()) + maps.Copy(allEnumsMap, foo.GetEnumsMetadata()) return allEnumsMap } @@ -152,7 +145,7 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, foo.GetStructsMetadata()) + maps.Copy(allStructsMap, foo.GetStructsMetadata()) return allStructsMap } @@ -167,7 +160,7 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, foo.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, foo.GetExceptionsMetadata()) return allExceptionsMap } @@ -182,7 +175,7 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, foo.GetServicesMetadata()) + maps.Copy(allServicesMap, foo.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/metadata.go index e4239b7ea4fce..4f64394d8266a 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/internals/metadata.go @@ -6,22 +6,15 @@ package internals import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/inject_metadata_fields/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/metadata.go index 2e8b6df25d525..3aaabae80f332 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/module/metadata.go @@ -6,24 +6,17 @@ package module import ( + "maps" + shared "shared" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = shared.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -127,7 +120,7 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, shared.GetEnumsMetadata()) + maps.Copy(allEnumsMap, shared.GetEnumsMetadata()) return allEnumsMap } @@ -142,7 +135,7 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, shared.GetStructsMetadata()) + maps.Copy(allStructsMap, shared.GetStructsMetadata()) return allStructsMap } @@ -157,7 +150,7 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, shared.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, shared.GetExceptionsMetadata()) return allExceptionsMap } @@ -172,7 +165,7 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, shared.GetServicesMetadata()) + maps.Copy(allServicesMap, shared.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/metadata.go index 833f660976126..7897df478eb99 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/shared/metadata.go @@ -6,22 +6,15 @@ package shared import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/metadata.go index b219f2e5493c0..c5e24edef7744 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -6,22 +6,15 @@ package cpp import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/metadata.go index ca9667067b04a..d4b9c390132bf 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go/gen-go/my/namespacing/test/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/metadata.go index bb302ad853234..0fb56b85660dd 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_emptyns/gen-go/emptyns/metadata.go @@ -6,22 +6,15 @@ package emptyns import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/metadata.go index faf8ed4578ab9..87723d4285ef5 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/extend/test/metadata.go @@ -6,24 +6,17 @@ package test import ( + "maps" + test0 "my/namespacing/test" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = test0.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -93,7 +86,7 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, test0.GetEnumsMetadata()) + maps.Copy(allEnumsMap, test0.GetEnumsMetadata()) return allEnumsMap } @@ -108,7 +101,7 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, test0.GetStructsMetadata()) + maps.Copy(allStructsMap, test0.GetStructsMetadata()) return allStructsMap } @@ -123,7 +116,7 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, test0.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, test0.GetExceptionsMetadata()) return allExceptionsMap } @@ -138,7 +131,7 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, test0.GetServicesMetadata()) + maps.Copy(allServicesMap, test0.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/metadata.go index ec724721d139c..4c746719358de 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_extend/gen-go/my/namespacing/test/metadata.go @@ -6,22 +6,15 @@ package test import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/metadata.go index 0668f10d079df..9662c8de4666b 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_hsmodule/gen-go/my/namespacing/test/metadata.go @@ -6,22 +6,15 @@ package test import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/metadata.go index 78b4c4076bb8f..2c413d6d7ef68 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace/out/go_quoted/gen-go/my/namespacing/test/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/metadata.go index 8bbdc996ce107..30eb13007c8b5 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package/out/go/gen-go/namespace_from_package/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/metadata.go index bb2d010acd5a0..6ae4b3278e86f 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/namespace_from_package_without_module_name/out/go/gen-go/namespace_from_package_without_module_name/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/metadata.go index c1328ca17b581..9b745fee651d8 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/optionals/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/params/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/params/out/go/gen-go/module/metadata.go index 5a22f797204d9..0407835f7ef5d 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/params/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/params/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/metadata.go index fd25da7d7589e..31f86d31bf390 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/module/metadata.go @@ -6,22 +6,15 @@ package module import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/serialization_field_order/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/metadata.go index af0c6b249daba..59591607c053b 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/terse_write/metadata.go @@ -6,22 +6,15 @@ package terse_write import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/metadata.go index b219f2e5493c0..c5e24edef7744 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -6,22 +6,15 @@ package cpp import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/metadata.go index 630d4543a1800..3769dfc875485 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/hack/metadata.go @@ -6,22 +6,15 @@ package hack import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/terse_write/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/included/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/included/metadata.go index 2787a6d22efca..093ee54bc9784 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/included/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/included/metadata.go @@ -6,22 +6,15 @@ package included import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/module/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/module/metadata.go index a7c847c421037..6d61c0caebfa4 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/module/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/module/metadata.go @@ -6,24 +6,17 @@ package module import ( + "maps" + included "included" thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - var _ = included.GoUnusedProtection__ // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types @@ -870,7 +863,7 @@ func GetEnumsMetadata() map[string]*metadata.ThriftEnum { } // ...now add enum metadatas from recursively included programs. - mapsCopy(allEnumsMap, included.GetEnumsMetadata()) + maps.Copy(allEnumsMap, included.GetEnumsMetadata()) return allEnumsMap } @@ -885,7 +878,7 @@ func GetStructsMetadata() map[string]*metadata.ThriftStruct { } // ...now add struct metadatas from recursively included programs. - mapsCopy(allStructsMap, included.GetStructsMetadata()) + maps.Copy(allStructsMap, included.GetStructsMetadata()) return allStructsMap } @@ -900,7 +893,7 @@ func GetExceptionsMetadata() map[string]*metadata.ThriftException { } // ...now add exception metadatas from recursively included programs. - mapsCopy(allExceptionsMap, included.GetExceptionsMetadata()) + maps.Copy(allExceptionsMap, included.GetExceptionsMetadata()) return allExceptionsMap } @@ -915,7 +908,7 @@ func GetServicesMetadata() map[string]*metadata.ThriftService { } // ...now add service metadatas from recursively included programs. - mapsCopy(allServicesMap, included.GetServicesMetadata()) + maps.Copy(allServicesMap, included.GetServicesMetadata()) return allServicesMap } diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/metadata.go index b219f2e5493c0..c5e24edef7744 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/cpp/metadata.go @@ -6,22 +6,15 @@ package cpp import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/metadata.go index 4d677114f4906..1b7e80b7a1f87 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/scope/metadata.go @@ -6,22 +6,15 @@ package scope import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types diff --git a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/metadata.go b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/metadata.go index 8aa2ab9b984c0..50017ae492afc 100644 --- a/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/metadata.go +++ b/third-party/thrift/src/thrift/compiler/test/fixtures/types/out/go/gen-go/thrift/annotation/thrift/metadata.go @@ -6,22 +6,15 @@ package thrift import ( + "maps" + thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift" metadata "github.com/facebook/fbthrift/thrift/lib/thrift/metadata" ) -// mapsCopy is a copy of maps.Copy from Go 1.21 -// TODO: remove mapsCopy once we can safely upgrade to Go 1.21 without requiring any rollback. -func mapsCopy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) { - for k, v := range src { - dst[k] = v - } -} - // (needed to ensure safety because of naive import list construction) var _ = thrift.ZERO -// TODO: uncomment when can safely upgrade to Go 1.21 without requiring any rollback. -// var _ = maps.Copy[map[int]int, map[int]int] +var _ = maps.Copy[map[int]int, map[int]int] var _ = metadata.GoUnusedProtection__ // Premade Thrift types