[
https://issues.apache.org/jira/browse/THRIFT-3467?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15227262#comment-15227262
]
ASF GitHub Bot commented on THRIFT-3467:
----------------------------------------
Github user Jens-G commented on a diff in the pull request:
https://github.com/apache/thrift/pull/976#discussion_r58624160
--- Diff: test/go/src/bin/stress/main.go ---
@@ -201,7 +201,27 @@ func client(protocolFactory thrift.TProtocolFactory) {
atomic.AddInt64(&clicounter, 1)
}
case echoSet:
- s := map[int8]bool{-10: true, -9: true, -8: true, -7: true, -6:
true, -5: true, -4: true, -3: true, -2: true, -1: true, 0: true, 1: true, 2:
true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true}
+ s := map[int8]struct{}{
+ -10: struct{}{},
+ -9: struct{}{},
+ -8: struct{}{},
+ -7: struct{}{},
+ -6: struct{}{},
+ -5: struct{}{},
+ -4: struct{}{},
+ -3: struct{}{},
+ -2: struct{}{},
+ -1: struct{}{},
+ 0: struct{}{},
+ 1: struct{}{},
+ 2: struct{}{},
+ 3: struct{}{},
+ 4: struct{}{},
+ 5: struct{}{},
+ 6: struct{}{},
+ 7: struct{}{},
+ 8: struct{}{},
+ }
--- End diff --
That's my favourite part of this change.
> Go Maps for Thrift Sets Should Have Values of Type struct{}
> ------------------------------------------------------------
>
> Key: THRIFT-3467
> URL: https://issues.apache.org/jira/browse/THRIFT-3467
> Project: Thrift
> Issue Type: Improvement
> Components: Go - Compiler
> Affects Versions: 0.9.3
> Reporter: Tom Deering
> Labels: golang
>
> Sets in Thrift are currently turned into maps with boolean values in Go.
> Example:
> Thrift
> {code}
> namespace go bug
> service FooService{
> void bar (1:set<string> foos)
> }
> {code}
> Go
> {code}
> func (p *FooServiceClient) Bar(foos map[string]bool) (err error)
> {code}
> Boolean map values waste memory. Map values should be of the zero-byte
> struct{} type.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)