Limit number of concurrent requests  [draft]

Limiting the number of concurrent http requests I was looking to use gorountine in the context of http requests. More specifically, how to limit the number of concurrent of http call made to a service. Let’s say you are making call to an API that is rate limited.

August 29, 2021 · 1 min · Nolan

Check for misspelled words

Checking for typos & misspell words I came across that project client9/misspell on github that aims to: “Correct commonly misspelled English words… quickly.” So I decided to try it directly for that blog by using a github action. Implementation Github action: name: Go on: [push, pull_request] jobs: build: name: Check for misspell runs-on: ubuntu-latest container: golang:1.15-buster steps: - uses: actions/checkout@v2 - run: |GO111MODULE=on go get -u github.com/client9/misspell/cmd/misspell@v0.3.4 misspell -error misspell blog/content/posts/*....

April 27, 2021 · 1 min · Nolan

Using GOPROXY

Getting dependencies via GOPROXY I recently wanted to use a private registry in a go project. It can be for many reasons: ensure immutability from one built to another ensure avaibility of a build (remember npm author who removed his library and broke half the internet?) get non-public library How it works Quick & Easy It is super easy you just have to add an env variable: export GOPROXY="myprivateserver....

April 19, 2021 · 1 min · Nolan

Golang code coverage badge in gitlab

Adding Golang code coverage badge in gitlab Currently there is no example in gitlab official documentation regarding code coverage for golang. However I found: https://medium.com/@ulm0_/golang-multi-packages-test-coverage-with-gitlab-ci-a7b52b91ef34 https://github.com/t-yuki/gocover-cobertura So I tried them out and it looks to work fine. Live Example I quickly made a test repo: https://gitlab.com/emirot.nolan/go-test-coverage/ To try that out and it work fine ! Here is the gitlab-ci.yml stages: - coveragetest test: stage: coveragetest image: golang script: - go get github....

April 16, 2021 · 1 min · Nolan

Monitoring golang web app with Datadog

Monitoring golang web application with Datadog Adding datdog monitoring for java was a matter of minutes, so I thought for golang it would be even faster. Get the datadog jar add it the the dockerfile entrypoint and that’s it. (assuming datadog env variables are set up correctly in k8s) It will be something like: RUN curl --retry 3 --connect-timeout 3 -Ss -o dd-java-agent.jar https://github.com/DataDog/dd-trace-java/releases/download/v0.78.1/dd-java-agent.jarENTRYPOINT [ "java", \ "-javaagent:dd-java-agent.jar", \ "-jar", "app....

April 15, 2021 · 2 min · Nolan

First golang project

Import Function form package I thought it was going to be similar to many languages and I will just have to just do something like: import "mypakckage/Myfuction" Well… no, first it will depend on your GOPATH, which is handled differently depending of your go version. Secondly, In golang exported function must be in Uppercase, otherwise it won’t compile! First module So I chose the easiest that I could find first to structure project by creating a module....

April 9, 2021 · 1 min · Nolan

First few lines in golang

Intro I’ve been casually looking into the go language without trying it much. Now it’s time to write so go code :) Golang Looping First discovery there is no while keyword in golang, I was pretty surprised I thought I was missing something. I then look in the spec and there is only for. I like that they only have limited number of keywords. i := 0 for i < 10 { fmt....

April 5, 2021 · 2 min · Nolan