golang enterprise, part 1, using a modules monorepo

Leveraging go workspaces Since go 1.18, we have a nice features, which is go workspaces. One thing that this brings is allowing to work nicely with multiple modules within one single workspace. Guess what it brings you? having multiple modules in one single monorepo! Take a look at this example Benefits Have all the important reusable company modules at the same place. Bringin a better collaboration, and easier discovery. Mutualize the CI (which is pretty easy) Have good folder structure, allowing the grouping of modules in topics Drawback ( The only drawback I could see until now it the coverage during the CI....

April 30, 2022 · 2 min · Me

golang errors (after 1.13)

Since go 1.13, go has gone one step further in terms of error handling. Errors can be wrapped, bubbled up and act upon. We will here take a step back on error handling in go, from the perspective of a library. What data could we have in the error? Inspired by a rust talk from Jan Lusby about errors, here are a few things that error could contain: The reason of the error Context of the error: struct field, struct surrounding values… Stack trace: which part of the code triggered this error How to fix the error: suggest a way to fix it Where are errors displayed?...

May 17, 2021 · 5 min · Me

golang 1.16 new feature: embed

What is it about In previous versions of go, you needed to reach out for an external package in order to embed static content inside your binary. My go to one was shurcool/vfsgen, but there were many others worth using. Go 1.16 brings a new package, “embed”, which allows to do that with just the standard library. How to do that The best part of this, it’s extremely simple, just see for yourself....

March 28, 2021 · 2 min · Me

golang binaries

Embedding anything in a golang binary What is it about? One good thing about golang is that you compile everything to a binary. So easy to deploy, so easy to manage, so small. But what happens when you need to embed files in there? Migration files, static files, whatever you can think of? Well, you can simply deploy it in a container, add this files, you are going to say, and you are probably right, that’s imho, the cleanest solution....

September 29, 2018 · 5 min · Me

a taste of wasm

Here it is, go 1.11 is out, and with it a new compilation target, Web Assembly! Let’s try it out! The test As dumb as it sounds, I needed a simple usecase to test this out. I decided to settle for the dumbest possible thing: a for loop incrementing a variable for 100000000 times. The git repo Here it is I uploaded it as well on surge for you to see without the hassle...

August 27, 2018 · 1 min · Me

Golang and Oracle

Which library To this day, the most up to date library seems to be rana/ora How to install (linux & macosx) Download Oracle Instant Client for linux x64: both packages Basic and SDK Unzip each of them in the same folder /opt/oracle mkdir -p /opt/oracle cd /opt/oracle unzip ~/Downloads/instantclient-basiclite-linux.x64-12.2.0.1.0.zip unzip ~/Downloads/instantclient-sdk-linux.x64-12.2.0.1.0.zip cd /opt/oracle/instantclient_12_1 Add the necessary env variables and paths: # Oracle export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=/opt/oracle export ORACLE_HOME=$LD_LIBRARY_PATH copy from the go package ....

December 27, 2016 · 1 min · Me

Ethereum contracts and Golang

The contract contract Trigger { function () { throw; } address owner; function Trigger() { owner = msg.sender; } event TriggerEvt(address _sender, uint _trigger); function trigger(uint _trigger) { TriggerEvt(msg.sender, _trigger); } function getOwner() constant returns (address) { return owner; } } This is a very simple contract that we will take as an example. Getting the right tools for binding A good starting point is this wiki. You will need to follow the install procedure of go-ethereum....

October 10, 2016 · 3 min · Me

Ethereum dev environment

Part 1 - Setup your ethereum node There are many ways you can setup a node to dev an Ethereum dapp. You can use the live network: not advisable obviously for cost and speed reasons. You can use the test network: not advisable for speed reasons. You can use a testchain set up with Geth: easy but a bit tedious as you need to mine. You can the ethereum testrpc: easiest!...

August 1, 2016 · 2 min · Me

golang dev environment setup

Golang environment install golang http://www.wolfe.id.au/2015/03/05/using-sublime-text-for-go-development/ Within sublimetext, from the package manager, install gosublime, install gooracle. install go/tools: go get -u golang.org/x/tools/cmd/goimports go get -u golang.org/x/tools/cmd/vet go get -u golang.org/x/tools/cmd/oracle go get -u golang.org/x/tools/cmd/godoc install gometalinter (https://github.com/alecthomas/gometalinter) install interfacer (https://github.com/mvdan/interfacer/) install gosimple (https://github.com/dominikh/go-simple) install gocov (https://github.com/axw/gocov) Here is the package settings I use for gosublime: { // you may set specific environment variables here // e.g "env": { "PATH": "$HOME/go/bin:$PATH" } // in values, $PATH and ${PATH} are replaced with // the corresponding environment(PATH) variable, if it exists....

February 20, 2016 · 2 min · Me