{"action":"created","issue":{"url":"https://api.github.com/repos/mattn/go-ole/issues/59","labels_url":"https://api.github.com/repos/mattn/go-ole/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/mattn/go-ole/issues/59/comments","events_url":"https://api.github.com/repos/mattn/go-ole/issues/59/events","html_url":"https://github.com/mattn/go-ole/issues/59","id":64090389,"number":59,"title":"Go Generate from IDL","user":{"login":"jacobsantos","id":314942,"avatar_url":"https://avatars.githubusercontent.com/u/314942?v=3","gravatar_id":"","url":"https://api.github.com/users/jacobsantos","html_url":"https://github.com/jacobsantos","followers_url":"https://api.github.com/users/jacobsantos/followers","following_url":"https://api.github.com/users/jacobsantos/following{/other_user}","gists_url":"https://api.github.com/users/jacobsantos/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobsantos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobsantos/subscriptions","organizations_url":"https://api.github.com/users/jacobsantos/orgs","repos_url":"https://api.github.com/users/jacobsantos/repos","events_url":"https://api.github.com/users/jacobsantos/events{/privacy}","received_events_url":"https://api.github.com/users/jacobsantos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-24T20:19:58Z","updated_at":"2015-03-24T20:22:02Z","closed_at":null,"body":"This has been on my wish list for a long time and with Go Generate tool, I think it could finally be achieved within a reasonable amount of time.\r\n\r\nThe idea is to generate the marshal code for structures and methods (and, or functions) based on the interfaces and classes found in the IDL, if one exists.\r\n\r\nSo the tool would generate all or most of the code required to interop with COM or OLE with the command:\r\n\r\n `go generate`\r\n\r\nwith the comment:\r\n\r\n `//go:generate go tool ole -o something.go -p idl_file`\r\n\r\nThe idea would also try to investigate searching for registered COM servers and pulling interface information like the Visual Studio tool shows to also build a go file. If possible it might look like:\r\n\r\n `//go:generate go tool ole -o something.go -p uuid`\r\n\r\nor\r\n\r\n `//go:generate go tool ole -o something.go -u uuid`\r\n\r\nThis might be incredibly difficult to implement, but as much as I hate porting existing code, I'm hoping it is possible.\r\n\r\nAnother option would be to accept a yaml or json file that describes the interface and classes. I would also suggest reading C or C++ for information as well, but that would require a more complicated parser.\r\n\r\nThe generated code will use library functions and helpers. *I'm unsure how everyone does their COM code. If I can get some examples, I might be able to have a better idea how the Go code should look like.*\r\n\r\nOne possible solution would be to generate structure types that match the class name and add methods for retrieving class properties and calling interface methods. So the structure types will be empty, possibly allowing for the programmer to extend the generated code.\r\n\r\nIf the generator only creates empty structure types, then it will ignore and not replace any attributes contained in that type. Documentation should potentially suggest that generated types are extended in a separate file and not directly modified.\r\n\r\n**Goal**:\r\n\r\nThe goal is to generate as much code as possible for the programmer through the `go generate` tool, by creating a tool that parses IDL file for COM type information.\r\n\r\nSecondary goal is to look up by system registry based on UUID or com server name.\r\n\r\nOptional 3rd goal is to accept json or yaml or both file formats and creating functions from that."},"comment":{"url":"https://api.github.com/repos/mattn/go-ole/issues/comments/85677240","html_url":"https://github.com/mattn/go-ole/issues/59#issuecomment-85677240","issue_url":"https://api.github.com/repos/mattn/go-ole/issues/59","id":85677240,"user":{"login":"jacobsantos","id":314942,"avatar_url":"https://avatars.githubusercontent.com/u/314942?v=3","gravatar_id":"","url":"https://api.github.com/users/jacobsantos","html_url":"https://github.com/jacobsantos","followers_url":"https://api.github.com/users/jacobsantos/followers","following_url":"https://api.github.com/users/jacobsantos/following{/other_user}","gists_url":"https://api.github.com/users/jacobsantos/gists{/gist_id}","starred_url":"https://api.github.com/users/jacobsantos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacobsantos/subscriptions","organizations_url":"https://api.github.com/users/jacobsantos/orgs","repos_url":"https://api.github.com/users/jacobsantos/repos","events_url":"https://api.github.com/users/jacobsantos/events{/privacy}","received_events_url":"https://api.github.com/users/jacobsantos/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T20:22:02Z","updated_at":"2015-03-24T20:22:02Z","body":"Well, should also generate some *_test.go files as well, if reasonably possible. Most likely based on an existing template."}}