blog.8-p.info

Go 1.14 Release Notes

go test -v now streams t.Log output as it happens, rather than at the end of all tests.

Finally!

Previously t.Log() and t.Logf() buffer the output till the end of a test, which was surprising. That forced me to use fmt.Printf() or whatever a logger available.

The issue has been opened since 2018 and it has finally landed on Go 1.14.

I use multiple programming languages and writing automated tests is one of the confusing parts. This is a cheat sheet to quickly check the difference of testing libraries.

Go

Go’s standard testing package doesn’t provide assert functions. A lot of projects use testify.

testify

  • assert.Equal(t, expected, actual)
  • require.Equal(t, expected, actual)

Perl

Test::More

  • is(actual, expected)

Python

pytest

  • assert expr

Rust

std

  • assert_eq!(left, right)

It let developers decide which one is expected, according to the Rust Programming Language.

Java

Hamcrest

  • assertThat(actual, matcher)

JUnit 5

  • assertEquals(expected, actual)

TestNG

  • assertEquals(actual, expected)

Back to Web Basics

Jul 27, 2019

I have migrated both 8-p.info and blog.8-p.info from Nuxt.js to Hugo.

Recently Mozilla’s podcast, IRL has started a new season. The latest episode was about The Internet’s Carbon Footprint, that introduced LOW←TECH MAGAZINE which is beautiful. Inspired by that and some other mostly static websites, I’m migrating off of Nuxt.js.

Nuxt.js is not bad, but using that for one-man websites is overkill. I see the new wave of web development, React, Vue or generally speaking “components” as a way to deal with scaling issues. If you have a lot of features and/or a lot of developers, having only basic tools may not work and new tools like “scoped” CSS work better. But I maintain mostly static websites by myself.

Good

  • Less dependencies. No node_modules.
  • Faster to build.
  • Hugo provides a development server with live-reload, a bit of template functionalities to separate common HTML snippets such as a header, and Markdown support.

Bad

  • blog.8-p.info doesn’t list old articles without JavaScript. It has to be pre-rendered without JavaScript, which I haven’t implemented by using Hugo’s template. I agree that isomorphic rendering makes sense, compared to implement something in different languages.
  • Go’s template is awkward

Overall I like Hugo better, even for non-blog websites. I also want to go further – how about getting rid of Google Analytics and custom fonts?

I recently learned that AWS SDK for Java’s official Developer Guide is having a section about checked exceptions – basically why it doesn’t use checked exceptions.

Exception Handling

In general, checked exceptions work well on small scales, but can become troublesome as applications grow and become more complex.

In v1 SDK, the section had links to three references, including Anders Hejlsberg’s interview in 2003. This would be handy when you need to convince someone regarding exceptions.

Joining AWS

Jul 3, 2019

I’m going to join Amazon Web Services from next week to work on containers.

I have read Docker in 2013 and blogged about that in Japanese, then I was tinkering Docker in 2014 which lost momentum after I moved to the States. So it is interesting to work on containers again.

One of the cool things about the team is that I will primarily work on open source software. I’ve been contributing open source software for long time. I even have a SourceForge account. But this is first time I do that as a full-time job!