Re: [go-nuts] x/term: go-keycodes
On Sun, May 14, 2017 at 6:02 PM, anatoly techtonikwrote: > On Fri, May 12, 2017 at 7:54 AM, Nigel Tao wrote: >> On Fri, May 12, 2017 at 3:11 AM, anatoly techtonik >> wrote: >>> I am new to Go and I need a cross-platform value for keyboard key codes to >>> make sure I can react to user key presses regardless of operating system >>> layer. >> >> FYI, there's already the key.Code type defined in >> https://github.com/golang/mobile/blob/master/event/key/key.go > > 1. So does that mean it will conflict if both are imported? > > Right now https://github.com/yakshaveinc/go-keycodes/blob/master/keycodes.go > uses KeyF11 while mobile lib uses CodeF11. For me Code is less clear > than Key, because from user point of view they press keys, not > symbols/characters of codes. It will not conflict. As for names, note that users of that package will refer to it by its qualified name: key.CodeF11, not a bare CodeF11. For example, with the net/http package in the standard library, the types are called Client and Server, which users of that package will see as http.Client and http.Server. It's not "type HTTPClient" which would become "http.HTTPClient". Even so, http.Client and rpc.Client (from the net/rpc package) will not conflict. > 2. Does it provide reverse mapping, so that if user press F11, go > program could write "KeyF11" to console? Yes, just call the String method, or just pass it to e.g. fmt.Printf("%v", etc). > 3. How should keycodes package be renames and placed so that I could > be reused in mobile? I'm not sure that it needs to be renamed, or that you need a new package. It might be fine for golang.org/x/term code to import golang.org/x/mobile packages. -- 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 an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] x/term: go-keycodes
On Fri, May 12, 2017 at 7:54 AM, Nigel Taowrote: > On Fri, May 12, 2017 at 3:11 AM, anatoly techtonik > wrote: >> I am new to Go and I need a cross-platform value for keyboard key codes to >> make sure I can react to user key presses regardless of operating system >> layer. > > FYI, there's already the key.Code type defined in > https://github.com/golang/mobile/blob/master/event/key/key.go 1. So does that mean it will conflict if both are imported? Right now https://github.com/yakshaveinc/go-keycodes/blob/master/keycodes.go uses KeyF11 while mobile lib uses CodeF11. For me Code is less clear than Key, because from user point of view they press keys, not symbols/characters of codes. 2. Does it provide reverse mapping, so that if user press F11, go program could write "KeyF11" to console? 3. How should keycodes package be renames and placed so that I could be reused in mobile? -- anatoly t. -- 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 an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] x/term: go-keycodes
On Fri, May 12, 2017 at 3:11 AM, anatoly techtonikwrote: > I am new to Go and I need a cross-platform value for keyboard key codes to > make sure I can react to user key presses regardless of operating system > layer. FYI, there's already the key.Code type defined in https://github.com/golang/mobile/blob/master/event/key/key.go -- 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 an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] x/term: go-keycodes
I am new to Go and I need a cross-platform value for keyboard key codes to make sure I can react to user key presses regardless of operating system layer. Thanks to the feedback from other projects, namely https://github.com/eiannone/keyboard and https://github.com/depp/keycode I was able to compile a package with key codes at https://github.com/yakshaveinc/go-keycodes which I'd like to make more "pythonic" for Go, and ideally merge into x/term. I need help with reviewing the code for best practices so that it could be included in stdlib. -- 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 an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.