[go-nuts] Run a method with nil pointer

2018-09-03 Thread Dat Huynh
Just a question. Why does Go allow to call a method with a nil pointer? https://play.golang.org/p/xPehesnfK9b Thanks, Dat. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send a

[go-nuts] encoding/csv: Is this a bug?

2017-07-17 Thread Dat Huynh
or MS Excel? Below is my code. package main import ( "encoding/csv" "fmt" "os" ) func main() { file, _ := os.Open("data.csv") defer file.Close() csvReader := csv.NewReader(file) records, _ := csvReader.ReadAll() for index, record := range records { fmt.Pr

Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Dat Huynh
he marshaling > step. However, the lib works as intended as of now in the sense that: > - it doesn't promise a roundtrip-ing ability > - it follows its marshaling and unmarshaling criteria > > Modifying the current marshaling steps would break go1compat ( > https://golang.o

Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Dat Huynh
I created an issue for this on github. https://github.com/golang/go/issues/20735 Regards, Dat. On Wed, Jun 21, 2017 at 9:30 AM, Ian Lance Taylor wrote: > On Mon, Jun 19, 2017 at 3:40 PM, Dat Huynh wrote: > > > > I am using the libraries "encoding/xml" and "e

Re: [go-nuts] Create methods for structs at runtime

2017-06-20 Thread Dat Huynh
I did with Java. Regards, Dat. On Wed, Jun 21, 2017 at 6:00 AM, Ian Lance Taylor wrote: > On Mon, Jun 19, 2017 at 8:38 PM, Dat Huynh wrote: > > > > On Tuesday, June 20, 2017 at 4:07:46 AM UTC+10, Ian Lance Taylor wrote: > >> > >> On Sat, Jun 17, 2017 at 5

Re: [go-nuts] Create methods for structs at runtime

2017-06-19 Thread Dat Huynh
On Tuesday, June 20, 2017 at 4:07:46 AM UTC+10, Ian Lance Taylor wrote: > > On Sat, Jun 17, 2017 at 5:17 PM, Dat Huynh > wrote: > > Why do you need this feature? > I have already answered the question in my email replying Lutz Horn. Thank you very much. Sincerely, Dat.

[go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-19 Thread Dat Huynh
Hi all, I am using the libraries "encoding/xml" and "encoding/json" to marshal and unmarshal a slice. I wonder why the method Unmarshal in encoding/xml does not return a slice as what I have from encoding/json. The below is my example. https://play.golang.org/p/ZlALkyCbzX Do I miss something or

Re: [go-nuts] Create methods for structs at runtime

2017-06-17 Thread Dat Huynh
14, 2017 at 2:34 PM, Ian Lance Taylor wrote: > On Tue, Jun 13, 2017 at 9:27 PM, Dat Huynh wrote: > > > > I have a question about Go. > > > > Given an interface, how can I create a struct instance with the methods > of > > the interface at runtime? > > &

Re: [go-nuts] Create methods for structs at runtime

2017-06-14 Thread Dat Huynh
Hi, What I want is to use interfaces to describe services for client side of my app. Then, I implement the services on the server side and allow client side to call the services via my pre-defined protocol (e.g HTTP, ...) In Java, I used the method newProxyInstance( ) of the class java.lang.r

[go-nuts] Create methods for structs at runtime

2017-06-13 Thread Dat Huynh
Hi all, I have a question about Go. Given an interface, how can I create a struct instance with the methods of the interface at runtime? After reading the document of Go on the web page https://golang.org/pkg/reflect/#StructOf I see the below statement. "StructOf currently does not generate wr

[go-nuts] Re: IDE for GOLANG

2016-08-02 Thread Dat Huynh
I use vimgo https://github.com/fatih/vim-go On Tuesday, August 2, 2016 at 10:25:21 PM UTC+10, kritika...@indiamart.com wrote: > > Hi, > is there IDE for creating a web service in GOLANG by using Revel framework > which follows MVC architecture. > > i am using Ubuntu .. > > > > *Watch our lat