From commits-return-101979-archive-asf-public=cust-asf.ponee.io@beam.apache.org Wed May 22 01:19:15 2019 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 811A818077A for ; Wed, 22 May 2019 03:19:15 +0200 (CEST) Received: (qmail 37043 invoked by uid 500); 22 May 2019 01:19:14 -0000 Mailing-List: contact commits-help@beam.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.apache.org Delivered-To: mailing list commits@beam.apache.org Received: (qmail 37034 invoked by uid 99); 22 May 2019 01:19:14 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2019 01:19:14 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id C075485D86; Wed, 22 May 2019 01:19:14 +0000 (UTC) Date: Wed, 22 May 2019 01:19:13 +0000 To: "commits@beam.apache.org" Subject: [beam] branch master updated: [BEAM-7354] Starcgen fix when no identifiers specified. (#8611) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155848795122.3061.7360643854982107739@gitbox.apache.org> From: altay@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: beam X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 6b328be42f324038df715cd0434cef75c7b742c3 X-Git-Newrev: 938ee3e805b40fdd5b1712a8bda9c9e0623fa470 X-Git-Rev: 938ee3e805b40fdd5b1712a8bda9c9e0623fa470 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. altay pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/beam.git The following commit(s) were added to refs/heads/master by this push: new 938ee3e [BEAM-7354] Starcgen fix when no identifiers specified. (#8611) 938ee3e is described below commit 938ee3e805b40fdd5b1712a8bda9c9e0623fa470 Author: Daniel Oliveira AuthorDate: Tue May 21 18:18:54 2019 -0700 [BEAM-7354] Starcgen fix when no identifiers specified. (#8611) If no identifiers are specified, the string.Split call as it is now generates a slice of length 1 with one empty string, which isn't a valid identifier and breaks the tool. This PR fixes it to the correct behavior, to use an empty slice when there are no identifiers. --- sdks/go/cmd/starcgen/starcgen.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sdks/go/cmd/starcgen/starcgen.go b/sdks/go/cmd/starcgen/starcgen.go index e3b627b..601ec13 100644 --- a/sdks/go/cmd/starcgen/starcgen.go +++ b/sdks/go/cmd/starcgen/starcgen.go @@ -172,7 +172,11 @@ func main() { if err != nil { log.Fatalf("error opening %q: %v", *output, err) } - if err := Generate(f, *output, pkg, strings.Split(*ids, ","), fset, fs); err != nil { + splitIds := make([]string, 0) // If no ids are specified, we should pass an empty slice. + if len(*ids) > 0 { + splitIds = strings.Split(*ids, ",") + } + if err := Generate(f, *output, pkg, splitIds, fset, fs); err != nil { log.Fatal(err) } }