davideisinger.com

My personal website
Log | Files | Refs | README

cloud-google-com-windxx.txt (15994B)


      1 [1]Jump to Content
      2 [2]
      3 Cloud
      4 [4]Blog
      5 [5]Contact sales [6]Get started for free
      6 [7][                    ]
      7 [13]
      8 Cloud
      9 [14]Blog
     10 
     11   • Solutions & technology
     12       □ [15]AI & Machine Learning
     13       □ [16]API Management
     14       □ [17]Application Development
     15       □ [18]Application Modernization
     16       □ [19]Chrome Enterprise
     17       □ [20]Compute
     18       □ [21]Containers & Kubernetes
     19       □ [22]Data Analytics
     20       □ [23]Databases
     21       □ [24]DevOps & SRE
     22       □ [25]Maps & Geospatial
     23       □ [26]Security & Identity
     24       □ [27]Infrastructure
     25       □ [28]Infrastructure Modernization
     26       □ [29]Networking
     27       □ [30]Productivity & Collaboration
     28       □ [31]SAP on Google Cloud
     29       □ [32]Storage & Data Transfer
     30       □ [33]Sustainability
     31   • Ecosystem
     32       □ [34]IT Leaders
     33       □ Industries
     34           ☆ [35]Financial Services
     35           ☆ [36]Healthcare & Life Sciences
     36           ☆ [37]Manufacturing
     37           ☆ [38]Media & Entertainment
     38           ☆ [39]Public Sector
     39           ☆ [40]Retail
     40           ☆ [41]Supply Chain
     41           ☆ [42]Telecommunications
     42       □ [43]Partners
     43       □ [44]Startups & SMB
     44       □ [45]Training & Certifications
     45       □ [46]Inside Google Cloud
     46       □ [47]Google Cloud Next & Events
     47       □ [48]Google Maps Platform
     48       □ [49]Google Workspace
     49   • [50]Developers & Practitioners
     50   • [51]Transform with Google Cloud
     51 
     52 [52]Contact sales [53]Get started for free
     53 [54][                    ]
     54 Application Modernization
     55 
     56 Why I love Go
     57 
     58 September 12, 2022
     59 
     60   • [60]
     61   • [61]
     62   • [62]
     63   • [63]
     64 
     65 David Yach
     66 
     67 Director of Engineering at Google Cloud
     68 
     69 I’ve been building software over the last four decades, as a developer, manager
     70 and executive in both small and large software companies. I started my career
     71 working on commercial compilers, first BASIC and then C. I have written a lot
     72 of code in many different languages, and managed teams with even broader
     73 language usage.
     74 
     75 I learned Go about 5 years ago when I was CTO at a startup/scaleup. At the
     76 time, we were looking to move to a microservice architecture, and that shift
     77 gave us the opportunity to consider moving away from the incumbent language
     78 (Scala). As I read through the Go tutorials, my compiler-writing background
     79 came back to me and I found myself repeatedly thinking “That’s cool – I know
     80 why the Go team did that!” So I got hooked on the language design.
     81 
     82 Learning
     83 
     84 I have worked with many different computer languages over the years, so I was
     85 not surprised I could quickly get started writing Go programs after reading
     86 through the online documents and tutorials. But then when I saw a new co-op
     87 student (a.k.a. intern) learn Go and write a substantial prototype in their
     88 first two weeks on the job, it became clear that Go was much easier to learn
     89 than many other languages.
     90 
     91 Writing code
     92 
     93 As I started writing my first Go programs, the first thing that struck me was
     94 the blazing compiler speed. It was as fast or faster starting my application
     95 than many interpreted languages, yet it was a compiled program with a strongly
     96 typed language. (I have an affinity for strongly typed languages – I have spent
     97 way too much time tracking down obscure issues in my own code in dynamic typed
     98 languages, where the same issue would have been a compile error in a strongly
     99 typed language.) Even better, in Go I often don’t need to declare the type –
    100 the compiler figures it out.
    101 
    102 I was impressed with the standard Go library – it included many of the
    103 capabilities required by modern applications – things like HTTP support, JSON
    104 handling and encryption. Many other languages required you to use a third-party
    105 library for these features, and often there were multiple competing libraries
    106 to choose from, adding another decision point for the developer. With Go, I
    107 could go to the standard library GoDoc and get started right away.
    108 
    109 There were a few other language decisions that I found helpful. One is that the
    110 compiler figures out if you are returning a pointer to a local, and behind the
    111 scenes allocates the memory rather than using the stack. This prevents bugs,
    112 and I find the code more readable. 
    113 
    114 I also like that you don’t declare that you support an interface. I wasn’t sure
    115 I would like this at first because it isn’t obvious if a type implements a
    116 particular interface, but I found greater value in the fact that I wasn’t
    117 dependent on the code author (even if it was me!) to declare that the interface
    118 is implemented. This first hit home when I used fmt.Println() and it
    119 automatically used the String() method I had implemented even though it hadn’t
    120 occurred to me that I was implementing the Stringer interface.
    121 
    122 The last feature I’ll note is the ability to do concurrent programming through
    123 channels and goroutines. The model is simple to understand yet powerful.
    124 
    125 Reading code
    126 
    127 After writing more Go code and starting to incorporate third party libraries, I
    128 had a realization that had never occurred to me before – as a developer, I
    129 spend a lot of time reading code. In fact, I probably spend more time reading
    130 code than writing it, once you start counting code reviews, debugging, and
    131 evaluating third-party libraries.
    132 
    133 What was different about reading Go code? I would summarize it by “it all looks
    134 the same.” What do I mean by that? Go format ensures all the braces are in the
    135 same spot; capitalized identifiers are exported; there are no implicit
    136 conversions, even of internal types; and there is no overloading of operators,
    137 functions or methods. That means that with Go code, “what you see is what you
    138 get” with no hidden meaning. Of course, it doesn’t help me to understand a
    139 complicated algorithm, but it does mean that I can concentrate more on that
    140 algorithm because I don’t have to understand whether ‘+’ is overloaded, for
    141 example.
    142 
    143 I was also pleasantly surprised when I used GoDoc on one of my projects, and
    144 discovered that I had semi-reasonable documentation without doing anything
    145 while writing the code other than adding comments on my functions and methods
    146 based on nagging from the IDE I was using. I did spend some time cleaning up
    147 the comments after that, but I’m not sure I would have even started that work
    148 if Go hadn’t given me a great starting point.
    149 
    150 Testing code
    151 
    152 Go test is part of the standard Go tools and supported by IDEs, making it easy
    153 to get started creating unit tests for my code. And like the standard Go
    154 library, having a standard way to do tests means I don’t have to evaluate
    155 external testing frameworks and select one. I can also understand the tests
    156 when I’m evaluating a third party library.
    157 
    158 Even better, the default behavior running package tests in VSCode is to enable
    159 Go’s built-in code coverage. I had never taken code coverage seriously working
    160 in other languages, partly because it was often difficult to set up. But the
    161 immediate feedback (helped by the blazing compile speed) gamified this for me,
    162 and I found myself adding tests to increase code coverage (and finding new bugs
    163 along the way).
    164 
    165 Go doesn’t allow circular dependencies between packages. While this has caused
    166 me some rethinking while writing code, I find it makes my testing regimen
    167 easier to think about – if I depend on a package, I can rely on that package to
    168 have its own tests covering its capabilities.
    169 
    170 Deploying code
    171 
    172 I learned Go at the same time we were migrating towards container-based
    173 microservices. In that environment, the fact that Go produces a single,
    174 self-contained executable makes it much easier and more efficient to build and
    175 manage containers. I can build a container layer with one single file, which is
    176 often a single-digit number of MB in size, compared to our prior JVM-based
    177 containers which started with hundreds of MB for the Java runtime then another
    178 layer for our application. (It is easy to forget how much this overhead ends up
    179 costing in production, particularly if you have hundreds or thousands of
    180 containers running).
    181 
    182 Second, Go has built-in cross compiling capabilities so our development
    183 machines, containers and cloud hardware don’t all have to all be on the same
    184 processor or operating system. For example, I can use a Linux build machine to
    185 produce client executables for Linux, Mac and Windows. Again, this takes away a
    186 complicated decision process due to artificial constraints.
    187 
    188 Finally, Go has established a well defined set of principles for versioning and
    189 compatibility. While not all pieces of this are enforced, having the principles
    190 from an authoritative source helps manage the real life challenges of keeping
    191 your software supply chain up to date. For example, it is strongly recommended
    192 that breaking changes require a new major version number. While not enforced,
    193 it leads the community to call out any open source package that violates this
    194 principle.
    195 
    196 What do I miss?
    197 
    198 I did miss generics; thankfully Go 1.18 added support. And I do wish the
    199 standard library offered immutable collections (like Scala and other functional
    200 languages). Embedding instead of inheritance works pretty much the same in many
    201 cases, but requires some deep thinking sometimes.
    202 
    203 My most frequent coding mistake is when I should have used a pointer receiver
    204 for a method and didn’t, then modify the receiver expecting the changes to be
    205 visible when the method returns. The code looks correct, the right values get
    206 assigned if I use a debugger to step through or issue prints, but the changes
    207 disappear after the method returns. I think I would have preferred if receivers
    208 were immutable, it would have caught these errors at compile time, and in the
    209 few remaining cases where I wanted to modify the receiver I would have copied
    210 it to a local variable.
    211 
    212 In conclusion
    213 
    214 As you can tell, I am a huge fan of Go, from even before I joined Google. I am
    215 impressed by the language and ecosystem design, and by the implementation. For
    216 me, Go makes me a more productive developer and I’m more confident in the
    217 quality of the code I produce.
    218 
    219 Go, give it a [64]try!
    220 
    221 Posted in
    222 
    223   • [65]Application Modernization
    224   • [66]Application Development
    225   • [67]Open Source
    226 
    227 Related articles
    228 
    229 [68]
    230 https://storage.googleapis.com/gweb-cloudblog-publish/images/
    231 containers_2022_anH39my.max-700x700.jpg
    232 DevOps & SRE
    233 
    234 Best practices for consuming public Docker Hub content
    235 
    236 By Rishi Mukhopadhyay • 2-minute read
    237 
    238 [69]
    239 https://storage.googleapis.com/gweb-cloudblog-publish/images/
    240 General-GC_Blog_header_2436x1200-v1.max-700x700.jpg
    241 Google Cloud
    242 
    243 The overwhelmed person’s guide to Google Cloud: week of Dec 18
    244 
    245 By Forrest Brazeal • 2-minute read
    246 
    247 [70]
    248 https://storage.googleapis.com/gweb-cloudblog-publish/images/
    249 Google_Cloud_AIML_thumbnail.max-700x700.jpg
    250 AI & Machine Learning
    251 
    252 Have the AI build your app for you!
    253 
    254 By Max Saltonstall • 2-minute read
    255 
    256 [71]
    257 https://storage.googleapis.com/gweb-cloudblog-publish/images/
    258 DO_NOT_USE_Wfx45fA.max-700x700.jpg
    259 Application Modernization
    260 
    261 Apollo24|7: Migrating a complex microservices application to Google Cloud with
    262 zero downtime
    263 
    264 By Nishu Saxena • 4-minute read
    265 
    266 Footer Links
    267 
    268 Follow us
    269 
    270   • [72]
    271   • [73]
    272   • [74]
    273   • [75]
    274   • [76]
    275 
    276 [77]
    277 
    278   • [78]Google Cloud
    279   • [79]Google Cloud Products
    280   • [80]Privacy
    281   • [81]Terms
    282   • [82]Cookies management controls
    283 
    284   • [83]Help
    285   • [84][Language  ]
    286 
    287 
    288 References:
    289 
    290 [1] https://cloud.google.com/blog/#content
    291 [2] https://cloud.google.com/
    292 [4] https://cloud.google.com/blog
    293 [5] https://cloud.google.com/contact/
    294 [6] https://console.cloud.google.com/freetrial/
    295 [13] https://cloud.google.com/
    296 [14] https://cloud.google.com/blog
    297 [15] https://cloud.google.com/blog/products/ai-machine-learning
    298 [16] https://cloud.google.com/blog/products/api-management
    299 [17] https://cloud.google.com/blog/products/application-development
    300 [18] https://cloud.google.com/blog/products/application-modernization
    301 [19] https://cloud.google.com/blog/products/chrome-enterprise
    302 [20] https://cloud.google.com/blog/products/compute
    303 [21] https://cloud.google.com/blog/products/containers-kubernetes
    304 [22] https://cloud.google.com/blog/products/data-analytics
    305 [23] https://cloud.google.com/blog/products/databases
    306 [24] https://cloud.google.com/blog/products/devops-sre
    307 [25] https://cloud.google.com/blog/topics/maps-geospatial
    308 [26] https://cloud.google.com/blog/products/identity-security
    309 [27] https://cloud.google.com/blog/products/infrastructure
    310 [28] https://cloud.google.com/blog/products/infrastructure-modernization
    311 [29] https://cloud.google.com/blog/products/networking
    312 [30] https://cloud.google.com/blog/products/productivity-collaboration
    313 [31] https://cloud.google.com/blog/products/sap-google-cloud
    314 [32] https://cloud.google.com/blog/products/storage-data-transfer
    315 [33] https://cloud.google.com/blog/topics/sustainability
    316 [34] https://cloud.google.com/transform
    317 [35] https://cloud.google.com/blog/topics/financial-services
    318 [36] https://cloud.google.com/blog/topics/healthcare-life-sciences
    319 [37] https://cloud.google.com/blog/topics/manufacturing
    320 [38] https://cloud.google.com/blog/products/media-entertainment
    321 [39] https://cloud.google.com/blog/topics/public-sector
    322 [40] https://cloud.google.com/blog/topics/retail
    323 [41] https://cloud.google.com/blog/topics/supply-chain-logistics
    324 [42] https://cloud.google.com/blog/topics/telecommunications
    325 [43] https://cloud.google.com/blog/topics/partners
    326 [44] https://cloud.google.com/blog/topics/startups
    327 [45] https://cloud.google.com/blog/topics/training-certifications
    328 [46] https://cloud.google.com/blog/topics/inside-google-cloud
    329 [47] https://cloud.google.com/blog/topics/google-cloud-next
    330 [48] https://cloud.google.com/blog/products/maps-platform
    331 [49] https://workspace.google.com/blog
    332 [50] https://cloud.google.com/blog/topics/developers-practitioners
    333 [51] https://cloud.google.com/transform
    334 [52] https://cloud.google.com/contact/
    335 [53] https://console.cloud.google.com/freetrial/
    336 [60] https://twitter.com/intent/tweet?text=Why%20I%20love%20Go%20@googlecloud&url=https://cloud.google.com/blog/products/application-modernization/why-david-yach-loves-go
    337 [61] https://www.linkedin.com/shareArticle?mini=true&url=https://cloud.google.com/blog/products/application-modernization/why-david-yach-loves-go&title=Why%20I%20love%20Go
    338 [62] https://www.facebook.com/sharer/sharer.php?caption=Why%20I%20love%20Go&u=https://cloud.google.com/blog/products/application-modernization/why-david-yach-loves-go
    339 [63] mailto:?subject=Why%20I%20love%20Go&body=Check%20out%20this%20article%20on%20the%20Cloud%20Blog:%0A%0AWhy%20I%20love%20Go%0A%0ALearn%20all%20the%20reasons%20David%20Yach,%20industry%20veteran%20and%20Director%20of%20Engineering%20at%20Google%20Cloud,%20loves%20to%20use%20Go%20for%20software%20development.%0A%0Ahttps://cloud.google.com/blog/products/application-modernization/why-david-yach-loves-go
    340 [64] https://go.dev/tour/list
    341 [65] https://cloud.google.com/blog/products/application-modernization
    342 [66] https://cloud.google.com/blog/products/application-development
    343 [67] https://cloud.google.com/blog/products/open-source
    344 [68] https://cloud.google.com/blog/products/devops-sre/using-authenticated-logins-for-docker-hub-in-google-cloud
    345 [69] https://cloud.google.com/blog/products/gcp/the-overwhelmed-persons-guide-to-google-cloud
    346 [70] https://cloud.google.com/blog/products/ai-machine-learning/have-duet-ai-make-your-next-app-using-conversation
    347 [71] https://cloud.google.com/blog/products/application-modernization/migrating-a-microservices-application-with-no-downtime
    348 [72] https://www.twitter.com/googlecloud
    349 [73] https://www.youtube.com/googlecloud
    350 [74] https://www.linkedin.com/showcase/google-cloud
    351 [75] https://www.instagram.com/googlecloud/
    352 [76] https://www.facebook.com/googlecloud/
    353 [77] https://cloud.google.com/
    354 [78] https://cloud.google.com/
    355 [79] https://cloud.google.com/products/
    356 [80] https://myaccount.google.com/privacypolicy?hl=en-US
    357 [81] https://myaccount.google.com/termsofservice?hl=en-US
    358 [82] https://cloud.google.com/blog/#
    359 [83] https://support.google.com/