From 37cea3c5a5415ef3ce8ee79c0c529f160f130b40 Mon Sep 17 00:00:00 2001 From: Alexandre Fiori Date: Thu, 24 Mar 2016 01:07:21 -0400 Subject: [PATCH] Print constructor before interface --- wsdlgo/encoder.go | 10 +++++----- wsdlgo/testdata/memcache.golden | 10 +++++----- wsdlgo/testdata/w3example1.golden | 10 +++++----- wsdlgo/testdata/w3example2.golden | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/wsdlgo/encoder.go b/wsdlgo/encoder.go index 4d1bb0e..0c386eb 100644 --- a/wsdlgo/encoder.go +++ b/wsdlgo/encoder.go @@ -254,6 +254,11 @@ func (ge *goEncoder) cacheSOAPOperations(d *wsdl.Definitions) { } var interfaceTypeT = template.Must(template.New("interfaceType").Parse(` +// New{{.Name}} creates an initializes a {{.Name}}. +func New{{.Name}}(cli *soap.Client) {{.Name}} { + return &{{.Impl}}{cli} +} + // {{.Name}}Interface was auto-generated from WSDL // and defines interface for the remote service. Useful for testing. type {{.Name}} interface { @@ -261,11 +266,6 @@ type {{.Name}} interface { {{.Doc}}{{.Name}}({{.Input}}) ({{.Output}}) {{ end }} } - -// New{{.Name}} creates an initializes a {{.Name}}. -func New{{.Name}}(cli *soap.Client) {{.Name}} { - return &{{.Impl}}{cli} -} `)) type interfaceTypeFunc struct{ Doc, Name, Input, Output string } diff --git a/wsdlgo/testdata/memcache.golden b/wsdlgo/testdata/memcache.golden index 3606741..1be77e3 100644 --- a/wsdlgo/testdata/memcache.golden +++ b/wsdlgo/testdata/memcache.golden @@ -9,6 +9,11 @@ import ( // Namespace was auto-generated from WSDL. var Namespace = "http://localhost:8080/MemoryService.wsdl" +// NewMemoryServicePortType creates an initializes a MemoryServicePortType. +func NewMemoryServicePortType(cli *soap.Client) MemoryServicePortType { + return &memoryServicePortType{cli} +} + // MemoryServicePortTypeInterface was auto-generated from WSDL // and defines interface for the remote service. Useful for testing. type MemoryServicePortType interface { @@ -22,11 +27,6 @@ type MemoryServicePortType interface { GetMulti(α *GetMultiRequest) (β *GetMultiResponse, err error) } -// NewMemoryServicePortType creates an initializes a MemoryServicePortType. -func NewMemoryServicePortType(cli *soap.Client) MemoryServicePortType { - return &memoryServicePortType{cli} -} - // Duration in WSDL format. type Duration string diff --git a/wsdlgo/testdata/w3example1.golden b/wsdlgo/testdata/w3example1.golden index 4dd6f49..849e5b1 100644 --- a/wsdlgo/testdata/w3example1.golden +++ b/wsdlgo/testdata/w3example1.golden @@ -9,6 +9,11 @@ import ( // Namespace was auto-generated from WSDL. var Namespace = "http://namespaces.snowboard-info.com" +// NewGetEndorsingBoarderPortType creates an initializes a GetEndorsingBoarderPortType. +func NewGetEndorsingBoarderPortType(cli *soap.Client) GetEndorsingBoarderPortType { + return &getEndorsingBoarderPortType{cli} +} + // GetEndorsingBoarderPortTypeInterface was auto-generated from WSDL // and defines interface for the remote service. Useful for testing. type GetEndorsingBoarderPortType interface { @@ -16,11 +21,6 @@ type GetEndorsingBoarderPortType interface { GetEndorsingBoarder(α *GetEndorsingBoarder) (β *GetEndorsingBoarderResponse, err error) } -// NewGetEndorsingBoarderPortType creates an initializes a GetEndorsingBoarderPortType. -func NewGetEndorsingBoarderPortType(cli *soap.Client) GetEndorsingBoarderPortType { - return &getEndorsingBoarderPortType{cli} -} - // GetEndorsingBoarder was auto-generated from WSDL. type GetEndorsingBoarder struct { XMLName xml.Name `xml:"http://namespaces.snowboard-info.com GetEndorsingBoarder" json:"-" yaml:"-"` diff --git a/wsdlgo/testdata/w3example2.golden b/wsdlgo/testdata/w3example2.golden index db4747e..d375cd0 100644 --- a/wsdlgo/testdata/w3example2.golden +++ b/wsdlgo/testdata/w3example2.golden @@ -9,6 +9,11 @@ import ( // Namespace was auto-generated from WSDL. var Namespace = "http://example.com/stockquote.wsdl" +// NewStockQuotePortType creates an initializes a StockQuotePortType. +func NewStockQuotePortType(cli *soap.Client) StockQuotePortType { + return &stockQuotePortType{cli} +} + // StockQuotePortTypeInterface was auto-generated from WSDL // and defines interface for the remote service. Useful for testing. type StockQuotePortType interface { @@ -16,11 +21,6 @@ type StockQuotePortType interface { GetLastTradePrice(α *TradePriceRequest) (β *TradePrice, err error) } -// NewStockQuotePortType creates an initializes a StockQuotePortType. -func NewStockQuotePortType(cli *soap.Client) StockQuotePortType { - return &stockQuotePortType{cli} -} - // TradePrice was auto-generated from WSDL. type TradePrice struct { Price float64 `xml:"price,omitempty" json:"price,omitempty" yaml:"price,omitempty"`