💾 Archived View for gmi.si3t.ch › sm4llth1ng › 2021-02-24.gmi captured on 2022-01-08 at 13:45:59. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-17)

🚧 View Differences

-=-=-=-=-=-=-

Bitten by a cache

Feb 24th, 2021

It's refreshing to build a new piece of software using as few

dependencies as possible. And to see where it will lead us.

For a new project, I chose Golang to change from my day to day python

programming, as well as to be able to deploy a single static self

contained executable. In addition, the ambition is to use vanilla Go,

talk directly SQL w/o an ORM, and talk http w/ only Go http library.

Using pair programming and test driven development, Go provides enough

testing support for our needs. Go is fast for compiling and running

tests. Part of this speed is achieved by caching everything that is not

changed bettween two runs.

During a session, we tried to run several time our tests without flushing

the database, removing a transaction begin/rollback in our tests. And we

sratched our head for a loooong time not understanding why the number of

rows was not increasing in the database, and the value of the first uuid

was not changing between runs...

It took us time to remember that when the source code of the test is not

modified, the test is not ran again. Only its result is displayed... as

the result is cached to only run the parts of the test suite that has

changed.

Bitten by the cache...

Our makefile has been updated to tell test runner not to use the cache,

it is currently fast enough to run every tests on each run.

test:
        @go test -count=1 ./...

It is great to learn / be reminded every day. :)