From dev-return-58032-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Sat Mar 28 18:25:02 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 86C8418057A for ; Sat, 28 Mar 2020 19:25:02 +0100 (CET) Received: (qmail 61357 invoked by uid 500); 28 Mar 2020 18:25:01 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 61345 invoked by uid 99); 28 Mar 2020 18:25:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Mar 2020 18:25:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id F10F4E0339 for ; Sat, 28 Mar 2020 18:25:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 5523578028F for ; Sat, 28 Mar 2020 18:25:00 +0000 (UTC) Date: Sat, 28 Mar 2020 18:25:00 +0000 (UTC) From: "Andrii Degtiarov (Jira)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (THRIFT-4173) Go: thrift compiler generates wrong code for list of aliased type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-4173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17069993#comment-17069993 ] Andrii Degtiarov commented on THRIFT-4173: ------------------------------------------ Feel free to close this ticket. Thank you! > Go: thrift compiler generates wrong code for list of aliased type > ------------------------------------------------------------------ > > Key: THRIFT-4173 > URL: https://issues.apache.org/jira/browse/THRIFT-4173 > Project: Thrift > Issue Type: Bug > Components: Compiler (General) > Affects Versions: 0.10.0 > Environment: Linux amd64/Mac OS Sierra > Reporter: Andrii Degtiarov > Priority: Major > > Thrift code bellow produced incorrect Go code. > In the generated code {noformat}var _elem1 int8{noformat} should be {noformat}var _elem1 StatType{noformat} and {noformat}temp := int8(v){noformat} should be {noformat}temp := StatType(v){noformat} > Thrift: > {code} > typedef i8 StatType > struct SomeStruct { > 1: list stats; > } > {code} > Generated code: > {code} > func (p *CSVAnalyzeTaskPayload) ReadField1(iprot thrift.TProtocol) error { > _, size, err := iprot.ReadListBegin() > if err != nil { > return thrift.PrependError("error reading list begin: ", err) > } > tSlice := make([]StatType, 0, size) > p.Stats = tSlice > for i := 0; i < size; i ++ { > var _elem1 int8 > if v, err := iprot.ReadByte(); err != nil { > return thrift.PrependError("error reading field 0: ", err) > } else { > temp := int8(v) > _elem1 = temp > } > p.Stats = append(p.Stats, _elem1) > } > if err := iprot.ReadListEnd(); err != nil { > return thrift.PrependError("error reading list end: ", err) > } > return nil > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)