Question on how 1Password X uses Javascript-transpiled Go code

Hi - I'm a very happy 1Password user but also had my attention drawn to the following tweet by Rick Fillion:

Rick was commenting that the 1Password team use lots of Go:

"Do we ever. Server and CLI are 100% Go, and there’s even Go transpiled to JS for some features of 1Password X."

I'm interested in knowing more about your "Go transpiled to JS". Rick suggested I post here to follow up.

I'm a contributor to the GopherJS project and was wondering, is it GopherJS you're using to transpile Go to JS?

Thanks in advance.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • beyer
    beyer
    1Password Alumni

    Hey @myitcv,

    I know that Rick guy! He is absolutely correct (probably helps he works here), we do transpile Go to JS. Specifically, what we lovingly call the brain which does all the heavy lifting for our website filling logic. All the transpiling is done using GopherJS! I vaguely remember the comment "We'll use GopherJS until we find something it can't handle" being thrown around, and I'm proud to say that has yet to be a problem.

    I hope that helps, but please let me know if you have any additional questions. Also thanks for your contributions to the GopherJS project!

    --
    Andrew Beyer (Ann Arbor, MI)
    Lifeline @ AgileBits

  • dteare
    edited November 2017

    Thank you so much for contributing to GopherJS, @myitcv! 1Password X wouldn't have been possible without it!

    When I started tinkering with 1Password X way back when, one of the biggest challenges was to get our form filling code ported over without relying on a desktop client. In theory we could have used Lua transpiled to JS, but I was relieved when I found GopherJS as it allowed us to use a modern language with a modern toolchain to build the brain.

    I'm still a relative newbie at Golang but everything I've seen so far I've loved. And it's a lot of fun watching Just For Func – Francesc has taught me most of what I know about Go :)

    One day I suspect we'll find a React-inspired Golang library and start writing UI in Go. I'm looking forward to that day!

    Take care,

    ++dave;

  • myitcv
    myitcv
    Community Member

    @beyer - thanks very much for the details, great to hear GopherJS is being used, but also that you haven't found any issues as yet.

    @dteare - Richard Musiol and Dmitri Shuralyov deserve the most thanks; I joined much later in the day so to speak!

    Francesc's series are fantastic I agree.

    As for a React-inspired Go library, I can point you towards a couple that I know of:

    Vecty

    Vecty is a React-like library for GopherJS so that you can do frontend development in Go instead of writing JavaScript/HTML/CSS.

    Written by Richard and maintained (predominantly) by Stephen Gutekanst and Dmitri, it is the most mature React-like library I know of. There is an active Slack community too in #vecty

    myitcv.io/react

    myitcv.io/react is a set of GopherJS bindings for Facebook's React, a Javascript library for building user interfaces.

    At the risk of blowing my own trumpet, this is a side project I've been working on. Less mature than Vecty, but it wraps the ReactJS library which makes it possible to use existing Javascript components from Go or vice versa. Makes heavy use of code generation too.

    I gave a talk at GolangUK 2017 where I talked through features and various examples.

    Very happy to hear any feedback etc; I tend to keep an eye on #gopherjs

    Thanks,

    Paul

  • beyer
    beyer
    1Password Alumni
    edited November 2017

    Wow @myitcv, this is freaking excellent! Thank you kindly for the information, especially the link to your talk. I now have something to play with on the weekend, as if there wasn't enough already! :tongue:

    P.S.: I'll pass this along to @dteare too!

    --
    Andrew Beyer (Ann Arbor, MI)
    Lifeline @ AgileBits

  • That's awesome! Thanks for sharing, Paul. Your talk looks interesting and is now on my Watch list. I'm behind on Francesc's series so I have to catch up there first but you're a close second ;)

    I totally need to hang out on #gopherjs more. I tend to enjoy learning things by trial and error, but I really should ask for pointers in the right direction more often. I just find it difficult to concentrate on things while Slack is open, so it ends up getting closed come coding time.

    Take care,

    ++dave;

This discussion has been closed.